C# Class MainScript, astrochimps

Inheritance: MonoBehaviour
Show file Open project: arcoelho01/astrochimps Class Usage Examples

Public Properties

Property Type Description
HUD int
MonkeyAstronaut Transform
MonkeyCientist Transform
MonkeyEngineer Transform
MonkeySaboteur Transform
Script MainScript
alliedLayer int
bnIsTheGamePaused bool
bnOnCutscene bool
bottomMenu GUIBottomMenu
cbCommandCenter CBuilding
cbResearchLab CBuilding
enemyLayer int
groundLayer int
isMinimapEnabled bool
lBoardedMonkeys List
lcRocketParts List
minimapGroundLayer int
minimapLayer int
mouseInputScript MouseWorldPosition
neutralLayer int
player CPlayer
playerObject Transform
prefabCaptureRay Transform
prefabDefeatByDeath Transform
prefabExtractor Transform
prefabFazenda Transform
prefabForceField Transform
prefabLaboratorio Transform
prefabUnderConstructionBox Transform
prefabVictorySequence Transform
questManager QuestManager
tLaunchingPlatform Transform

Public Methods

Method Description
ChangeDroneTeamAndUpdateList ( Transform droneObject, int droneLayer ) : void

Updates the drone's list when one of them change teams

CheckIfAllMonkeysAreBoarded ( ) : void

Check if we have all the monkeys boarded in the rocket. If so, the game was won!

CheckIfAllMonkeysAreConvicts ( ) : void

Check if we all our monkeys are not under prison. If so, we lost the game. Usually, this function is called when a drone delivers a monkey to a prison

CheckIfAreEnoughResourcesToBuild ( Transform objectToBuild ) : bool

Just check if we have enough resources to build this unit/structure

CheckIfTargetColliderIsInRange ( Vector3 callerPosition, Transform tTarget, int targetLayer, float fRadius ) : bool

Check for enemies (collider, actually) inside a radius

CheckIfTargetIsInRange ( Transform tAttacker, Transform tTarget, float fAttackRange ) : bool

Check if a target is in the range of this unit, projecting it's position in the 2D floor plane (only uses x and z coordinates)

CheckIfWeHaveOxygen ( ) : void

Check if we have enough oxygen to keep the monkeys alive

DeployUnderConstructionBox ( Transform builtOver, Transform prefabToBuild, Vector3 position, float buildTime ) : void

Create an instance of an 'Under Construction Box'

DeployUnderConstructionBox ( Vector3 position, float buildTime ) : void

Overloaded method: only deploys the construction box, wait the time and then destroy it. Doesn't instantiate the new building

GetCurrentUnitsInScene ( ) : void

Get all units in the scene, filters them and add them to the corresponding list

GetListOfAllAlliedBuildings ( ) : List
GetListOfAllMonkeys ( ) : List

Returns the list of all monkeys currently in the game

GetListOfAllNeutralResources ( ) : List
GetListOfAllRocketParts ( ) : List

Returns the list of all rocket parts transforms found in the scene

GetListOfAllRocketPartsComponents ( ) : List

Returns the list of all rocket parts CRocketPart components for the parts found in the scene

ReceiveNewEvent ( Transform trSender, QuestManager eEvent ) : void

Receive an event

getExtractRate ( ) : float
getFabricRate ( ) : float
getTaxaConsumoOxigenio ( ) : float
setDroneVisaoAumentada ( ) : void
setDroneVisaoNormal ( ) : void
setExtractRate ( float rate ) : void
setFabricRate ( float rate ) : void
setTaxaConsumoOxigenio ( float rate ) : void

Private Methods

Method Description
Awake ( ) : void
CheckInputKeys ( ) : void

Check for user input

DeployConstructionBox ( Vector3 position, float timeToBuild ) : IEnumerator

Create a version of Freddy's construction box

DoCheatingStuff ( ) : void

Do some cheats, for development purposes only

GameOverStartDeathByAsphyxiationSequence ( ) : void

Call the scenes when the player has no oxygen left, so the monkeys die asphyxiated

GameOverStartJailedSequence ( ) : void

What happens when the game is lost For now this happens when all player's monkeys are in jail

GameOverStartVictorySequence ( ) : void
GetCurrentDronesInScene ( ) : void

Get all drones in the scene

GetCurrentRocketPartsInScene ( ) : void

Get all the rocket parts currently in the game

GetMonkeysObjects ( ) : void

Get all monkeys in the scene, sort them by class and add their transforms to the variables declared up in this script. With this, we get shortcuts to them

Start ( ) : void
Update ( ) : void

Method Details

ChangeDroneTeamAndUpdateList() public method

Updates the drone's list when one of them change teams
public ChangeDroneTeamAndUpdateList ( Transform droneObject, int droneLayer ) : void
droneObject Transform
droneLayer int
return void

CheckIfAllMonkeysAreBoarded() public method

Check if we have all the monkeys boarded in the rocket. If so, the game was won!
public CheckIfAllMonkeysAreBoarded ( ) : void
return void

CheckIfAllMonkeysAreConvicts() public method

Check if we all our monkeys are not under prison. If so, we lost the game. Usually, this function is called when a drone delivers a monkey to a prison
public CheckIfAllMonkeysAreConvicts ( ) : void
return void

CheckIfAreEnoughResourcesToBuild() public method

Just check if we have enough resources to build this unit/structure
public CheckIfAreEnoughResourcesToBuild ( Transform objectToBuild ) : bool
objectToBuild Transform
return bool

CheckIfTargetColliderIsInRange() public method

Check for enemies (collider, actually) inside a radius
public CheckIfTargetColliderIsInRange ( Vector3 callerPosition, Transform tTarget, int targetLayer, float fRadius ) : bool
callerPosition Vector3 The position to be the sphere center. Usually is the center of the caller's /// collider
tTarget Transform Target's transform, so we can filter the colliders inside the radius and know for /// sure if we touched the target
targetLayer int Target's layer, used for filtering colliders
fRadius float Radius of the sphere where we will check for other objects presence. Usually the /// caller's attack radius
return bool

CheckIfTargetIsInRange() public method

Check if a target is in the range of this unit, projecting it's position in the 2D floor plane (only uses x and z coordinates)
public CheckIfTargetIsInRange ( Transform tAttacker, Transform tTarget, float fAttackRange ) : bool
tAttacker Transform Transform of the attacker
tTarget Transform Transform of the target
fAttackRange float A float with the range of the attack
return bool

CheckIfWeHaveOxygen() public method

Check if we have enough oxygen to keep the monkeys alive
public CheckIfWeHaveOxygen ( ) : void
return void

DeployUnderConstructionBox() public method

Create an instance of an 'Under Construction Box'
public DeployUnderConstructionBox ( Transform builtOver, Transform prefabToBuild, Vector3 position, float buildTime ) : void
builtOver Transform Transform of the object where this Box is built. With this, we can pass a /// Resource back to a built extractor, for instance. We can call it as null
prefabToBuild Transform Prefab to the building which will be built we te timer is over.
position Vector3 A Vector3 with the position to create the box and instantiate the new building, /// if any
buildTime float Time to build the building. When it's over, it will instantiate a new building, /// show the complete animation and will destroy itself
return void

DeployUnderConstructionBox() public method

Overloaded method: only deploys the construction box, wait the time and then destroy it. Doesn't instantiate the new building
public DeployUnderConstructionBox ( Vector3 position, float buildTime ) : void
position Vector3 A Vector3 with the position to create the box
buildTime float Time to build the building. When it's over, will show the complete animation /// and will destroy itself
return void

GetCurrentUnitsInScene() public method

Get all units in the scene, filters them and add them to the corresponding list
public GetCurrentUnitsInScene ( ) : void
return void

GetListOfAllAlliedBuildings() public method

public GetListOfAllAlliedBuildings ( ) : List
return List

GetListOfAllMonkeys() public method

Returns the list of all monkeys currently in the game
public GetListOfAllMonkeys ( ) : List
return List

GetListOfAllNeutralResources() public method

public GetListOfAllNeutralResources ( ) : List
return List

GetListOfAllRocketParts() public method

Returns the list of all rocket parts transforms found in the scene
public GetListOfAllRocketParts ( ) : List
return List

GetListOfAllRocketPartsComponents() public method

Returns the list of all rocket parts CRocketPart components for the parts found in the scene
public GetListOfAllRocketPartsComponents ( ) : List
return List

ReceiveNewEvent() public method

Receive an event
public ReceiveNewEvent ( Transform trSender, QuestManager eEvent ) : void
trSender Transform Transform of the sender of this event
eEvent QuestManager EQuestEvents enum with the event
return void

getExtractRate() public static method

public static getExtractRate ( ) : float
return float

getFabricRate() public static method

public static getFabricRate ( ) : float
return float

getTaxaConsumoOxigenio() public method

public getTaxaConsumoOxigenio ( ) : float
return float

setDroneVisaoAumentada() public method

public setDroneVisaoAumentada ( ) : void
return void

setDroneVisaoNormal() public method

public setDroneVisaoNormal ( ) : void
return void

setExtractRate() public static method

public static setExtractRate ( float rate ) : void
rate float
return void

setFabricRate() public static method

public static setFabricRate ( float rate ) : void
rate float
return void

setTaxaConsumoOxigenio() public method

public setTaxaConsumoOxigenio ( float rate ) : void
rate float
return void

Property Details

HUD public static property

public static int HUD
return int

MonkeyAstronaut public static property

public static Transform MonkeyAstronaut
return Transform

MonkeyCientist public static property

public static Transform MonkeyCientist
return Transform

MonkeyEngineer public static property

public static Transform MonkeyEngineer
return Transform

MonkeySaboteur public static property

public static Transform MonkeySaboteur
return Transform

Script public static property

public static MainScript Script
return MainScript

alliedLayer public static property

public static int alliedLayer
return int

bnIsTheGamePaused public property

public bool bnIsTheGamePaused
return bool

bnOnCutscene public property

public bool bnOnCutscene
return bool

bottomMenu public property

public GUIBottomMenu bottomMenu
return GUIBottomMenu

cbCommandCenter public static property

public static CBuilding cbCommandCenter
return CBuilding

cbResearchLab public static property

public static CBuilding cbResearchLab
return CBuilding

enemyLayer public static property

public static int enemyLayer
return int

groundLayer public static property

public static int groundLayer
return int

isMinimapEnabled public property

public bool isMinimapEnabled
return bool

lBoardedMonkeys public property

public List lBoardedMonkeys
return List

lcRocketParts public static property

public static List lcRocketParts
return List

minimapGroundLayer public static property

public static int minimapGroundLayer
return int

minimapLayer public static property

public static int minimapLayer
return int

mouseInputScript public static property

public static MouseWorldPosition mouseInputScript
return MouseWorldPosition

neutralLayer public static property

public static int neutralLayer
return int

player public property

public CPlayer player
return CPlayer

playerObject public property

public Transform playerObject
return Transform

prefabCaptureRay public property

public Transform prefabCaptureRay
return Transform

prefabDefeatByDeath public property

public Transform prefabDefeatByDeath
return Transform

prefabExtractor public property

public Transform prefabExtractor
return Transform

prefabFazenda public property

public Transform prefabFazenda
return Transform

prefabForceField public property

public Transform prefabForceField
return Transform

prefabLaboratorio public property

public Transform prefabLaboratorio
return Transform

prefabUnderConstructionBox public property

public Transform prefabUnderConstructionBox
return Transform

prefabVictorySequence public property

public Transform prefabVictorySequence
return Transform

questManager public property

public QuestManager questManager
return QuestManager

tLaunchingPlatform public static property

public static Transform tLaunchingPlatform
return Transform