C# Class CMonkey, astrochimps

Class with monkey's definitions
Inheritance: CBaseEntity
Mostrar archivo Open project: arcoelho01/astrochimps Class Usage Examples

Public Properties

Property Type Description
attackRange float
iconPrefab Transform
monkeyClass eMonkeyType
sfxAckAstronaut UnityEngine.AudioClip
sfxAckCientist UnityEngine.AudioClip
sfxAckDefault UnityEngine.AudioClip
sfxAckEngineer UnityEngine.AudioClip
sfxAckSaboteur UnityEngine.AudioClip
sfxAttackAckAstronaut UnityEngine.AudioClip
sfxAttackAckCientist UnityEngine.AudioClip
sfxAttackAckEngineer UnityEngine.AudioClip
sfxAttackAckSaboteur UnityEngine.AudioClip
sfxAttackAstronaut UnityEngine.AudioClip
sfxAttackCientist UnityEngine.AudioClip
sfxAttackEngineer UnityEngine.AudioClip
sfxAttackSaboteur UnityEngine.AudioClip
sfxAttacked UnityEngine.AudioClip
sfxAttackedAstronaut UnityEngine.AudioClip
sfxAttackedCientist UnityEngine.AudioClip
sfxAttackedEngineer UnityEngine.AudioClip
sfxAttackedSaboteur UnityEngine.AudioClip
sfxDying UnityEngine.AudioClip
sfxReprogramming UnityEngine.AudioClip
sfxResearchComplete UnityEngine.AudioClip
sfxSelectedAstronaut UnityEngine.AudioClip
sfxSelectedCientist UnityEngine.AudioClip
sfxSelectedDefault UnityEngine.AudioClip
sfxSelectedEngineer UnityEngine.AudioClip
sfxSelectedIdle UnityEngine.AudioClip
sfxSelectedSaboteur UnityEngine.AudioClip
stepDustPrefab Transform
workingMouseState MouseWorldPosition.eMouseStates

Public Methods

Method Description
Awake ( ) : void

When the script is initialized

CapturedBy ( Transform capturer, Transform captureSpot, Transform captureRaySpot ) : void

Tells to this monkey that it is being captured by an enemy hunter drone, setting it up (stop walking, deselect the monkey and doesn't allow it to walk anymore until it's released

CientistRevealedRocketParts ( ) : void

The Cientist have finished the researched and found all rocket parts

EnterNewState ( FSMState, eNewState ) : void

Changes the FSM to a new state

ExecuteCurrentState ( ) : void

Executes the FSM current state

GetColliderInfo ( ) : void

Get info about the collider in this object. This is needed so we know what are the boundaries of the object. With this, we can calculate the distance of the object from others, knowing if we can attack them, for instance

InstantiateADustCloud ( ) : void

Instantiate a simple particle emitter to simulate dust on the monkey step. Auto-destroy it after a couple of seconds

IsInsideAPrison ( ) : bool

Shortcut to check if a monkey is inside a prison: must be with the isCaptured flag on and be inside a building.

KillMonkey ( ) : void

LeaveCurrentState ( ) : void

Leaves the current state. Used whenever the FSM enters a new state

LoadMinimapIcon ( ) : void

Loads the appropriate icon to display in the minimap. It should depends on the side (allied or opponent), type of object and visibility

LoopWalkCycle ( ) : void

Manages the walk cycle loop

MonkeyAttack ( ) : void
OnAStarReachedEndOfPath ( Transform eventRaiser, bool isMoving ) : void

What to do when the event is raised.

OnDisable ( ) : void

What to do when this object is disabled

OnDrawGizmos ( ) : void

Draw some helpers on screen

OnEnable ( ) : void

What to do when this object is enabled

OnSabotageStatusChange ( CBuilding, buildingEventRaiser, bool bnSabotageStatus ) : void

Called by an event when a building is sabotaged or fixed. Useful for the Cientist, for instance, to know if it can keep researching

PerformAction ( Transform transTarget, MouseWorldPosition, currentMouseState ) : void

Attack a target. Actually, 'attack' could be replaced by 'perform some action on...', because we using this function also to repair buildings, capture rocket parts, etc.

Performs the 'attack' of the monkey

ReleaseMe ( ) : void

When the monkey is released we need to setup a few things before call the ReleaseMe() from CBaseEntity

Select ( ) : Transform

Selected is overriden to play a sound

Update ( ) : void

Update

WalkTo ( Vector3 walkTo ) : void

Used to send a monkey to a point in the terrain. It will keep the target's position and change to the 'walking' state

WorkIsDone ( ) : void

The monkey is doing some task, and it's now finished. Check what task it is and call the appropriate function

getFSMCurrentState ( ) : FSMState,
getResearchIsComplete ( ) : bool
playAckSound ( ) : void
playAttackAckSound ( ) : void
playAttackSound ( ) : void
playCapturedSound ( ) : void
playResearchComplete ( ) : void
playSelectedSound ( ) : void

Private Methods

Method Description
CheckIfTargetIsInRange ( ) : bool

Throws a raycast to check if the target is in range

GetAttackSpot ( ) : Transform

Find the attack spot object for the Astronaut monkey

GetCurrentState ( ) : FSMState,

Returns the FSM current state

Method Details

Awake() public method

When the script is initialized
public Awake ( ) : void
return void

CapturedBy() public method

Tells to this monkey that it is being captured by an enemy hunter drone, setting it up (stop walking, deselect the monkey and doesn't allow it to walk anymore until it's released
public CapturedBy ( Transform capturer, Transform captureSpot, Transform captureRaySpot ) : void
capturer Transform
captureSpot Transform
captureRaySpot Transform
return void

CientistRevealedRocketParts() public method

The Cientist have finished the researched and found all rocket parts
public CientistRevealedRocketParts ( ) : void
return void

EnterNewState() public method

Changes the FSM to a new state
public EnterNewState ( FSMState, eNewState ) : void
eNewState FSMState, The new state
return void

ExecuteCurrentState() public method

Executes the FSM current state
public ExecuteCurrentState ( ) : void
return void

GetColliderInfo() public method

Get info about the collider in this object. This is needed so we know what are the boundaries of the object. With this, we can calculate the distance of the object from others, knowing if we can attack them, for instance
public GetColliderInfo ( ) : void
return void

InstantiateADustCloud() public method

Instantiate a simple particle emitter to simulate dust on the monkey step. Auto-destroy it after a couple of seconds
public InstantiateADustCloud ( ) : void
return void

IsInsideAPrison() public method

Shortcut to check if a monkey is inside a prison: must be with the isCaptured flag on and be inside a building.
public IsInsideAPrison ( ) : bool
return bool

KillMonkey() public method

public KillMonkey ( ) : void
return void

LeaveCurrentState() public method

Leaves the current state. Used whenever the FSM enters a new state
public LeaveCurrentState ( ) : void
return void

LoadMinimapIcon() public method

Loads the appropriate icon to display in the minimap. It should depends on the side (allied or opponent), type of object and visibility
public LoadMinimapIcon ( ) : void
return void

LoopWalkCycle() public method

Manages the walk cycle loop
public LoopWalkCycle ( ) : void
return void

MonkeyAttack() public method

public MonkeyAttack ( ) : void
return void

OnAStarReachedEndOfPath() public method

What to do when the event is raised.
public OnAStarReachedEndOfPath ( Transform eventRaiser, bool isMoving ) : void
eventRaiser Transform
isMoving bool
return void

OnDisable() public method

What to do when this object is disabled
public OnDisable ( ) : void
return void

OnDrawGizmos() public method

Draw some helpers on screen
public OnDrawGizmos ( ) : void
return void

OnEnable() public method

What to do when this object is enabled
public OnEnable ( ) : void
return void

OnSabotageStatusChange() public method

Called by an event when a building is sabotaged or fixed. Useful for the Cientist, for instance, to know if it can keep researching
public OnSabotageStatusChange ( CBuilding, buildingEventRaiser, bool bnSabotageStatus ) : void
buildingEventRaiser CBuilding, CBuilding component of whoever sended the event message
bnSabotageStatus bool True if the building was sabotaged, false if it is fixed
return void

PerformAction() public method

Attack a target. Actually, 'attack' could be replaced by 'perform some action on...', because we using this function also to repair buildings, capture rocket parts, etc. Performs the 'attack' of the monkey
public PerformAction ( Transform transTarget, MouseWorldPosition, currentMouseState ) : void
transTarget Transform Transform of the targeted object
currentMouseState MouseWorldPosition, A enum with the mouse state when the player issued an order
return void

ReleaseMe() public method

When the monkey is released we need to setup a few things before call the ReleaseMe() from CBaseEntity
public ReleaseMe ( ) : void
return void

Select() public method

Selected is overriden to play a sound
public Select ( ) : Transform
return Transform

Update() public method

Update
public Update ( ) : void
return void

WalkTo() public method

Used to send a monkey to a point in the terrain. It will keep the target's position and change to the 'walking' state
public WalkTo ( Vector3 walkTo ) : void
walkTo Vector3 A Vector3 with the position to walk to
return void

WorkIsDone() public method

The monkey is doing some task, and it's now finished. Check what task it is and call the appropriate function
public WorkIsDone ( ) : void
return void

getFSMCurrentState() public method

public getFSMCurrentState ( ) : FSMState,
return FSMState,

getResearchIsComplete() public method

public getResearchIsComplete ( ) : bool
return bool

playAckSound() public method

public playAckSound ( ) : void
return void

playAttackAckSound() public method

public playAttackAckSound ( ) : void
return void

playAttackSound() public method

public playAttackSound ( ) : void
return void

playCapturedSound() public method

public playCapturedSound ( ) : void
return void

playResearchComplete() public method

public playResearchComplete ( ) : void
return void

playSelectedSound() public method

public playSelectedSound ( ) : void
return void

Property Details

attackRange public_oe property

public float attackRange
return float

iconPrefab public_oe property

public Transform iconPrefab
return Transform

monkeyClass public_oe property

public eMonkeyType monkeyClass
return eMonkeyType

sfxAckAstronaut public_oe property

public AudioClip,UnityEngine sfxAckAstronaut
return UnityEngine.AudioClip

sfxAckCientist public_oe property

public AudioClip,UnityEngine sfxAckCientist
return UnityEngine.AudioClip

sfxAckDefault public_oe property

public AudioClip,UnityEngine sfxAckDefault
return UnityEngine.AudioClip

sfxAckEngineer public_oe property

public AudioClip,UnityEngine sfxAckEngineer
return UnityEngine.AudioClip

sfxAckSaboteur public_oe property

public AudioClip,UnityEngine sfxAckSaboteur
return UnityEngine.AudioClip

sfxAttackAckAstronaut public_oe property

public AudioClip,UnityEngine sfxAttackAckAstronaut
return UnityEngine.AudioClip

sfxAttackAckCientist public_oe property

public AudioClip,UnityEngine sfxAttackAckCientist
return UnityEngine.AudioClip

sfxAttackAckEngineer public_oe property

public AudioClip,UnityEngine sfxAttackAckEngineer
return UnityEngine.AudioClip

sfxAttackAckSaboteur public_oe property

public AudioClip,UnityEngine sfxAttackAckSaboteur
return UnityEngine.AudioClip

sfxAttackAstronaut public_oe property

public AudioClip,UnityEngine sfxAttackAstronaut
return UnityEngine.AudioClip

sfxAttackCientist public_oe property

public AudioClip,UnityEngine sfxAttackCientist
return UnityEngine.AudioClip

sfxAttackEngineer public_oe property

public AudioClip,UnityEngine sfxAttackEngineer
return UnityEngine.AudioClip

sfxAttackSaboteur public_oe property

public AudioClip,UnityEngine sfxAttackSaboteur
return UnityEngine.AudioClip

sfxAttacked public_oe property

public AudioClip,UnityEngine sfxAttacked
return UnityEngine.AudioClip

sfxAttackedAstronaut public_oe property

public AudioClip,UnityEngine sfxAttackedAstronaut
return UnityEngine.AudioClip

sfxAttackedCientist public_oe property

public AudioClip,UnityEngine sfxAttackedCientist
return UnityEngine.AudioClip

sfxAttackedEngineer public_oe property

public AudioClip,UnityEngine sfxAttackedEngineer
return UnityEngine.AudioClip

sfxAttackedSaboteur public_oe property

public AudioClip,UnityEngine sfxAttackedSaboteur
return UnityEngine.AudioClip

sfxDying public_oe property

public AudioClip,UnityEngine sfxDying
return UnityEngine.AudioClip

sfxReprogramming public_oe property

public AudioClip,UnityEngine sfxReprogramming
return UnityEngine.AudioClip

sfxResearchComplete public_oe property

public AudioClip,UnityEngine sfxResearchComplete
return UnityEngine.AudioClip

sfxSelectedAstronaut public_oe property

public AudioClip,UnityEngine sfxSelectedAstronaut
return UnityEngine.AudioClip

sfxSelectedCientist public_oe property

public AudioClip,UnityEngine sfxSelectedCientist
return UnityEngine.AudioClip

sfxSelectedDefault public_oe property

public AudioClip,UnityEngine sfxSelectedDefault
return UnityEngine.AudioClip

sfxSelectedEngineer public_oe property

public AudioClip,UnityEngine sfxSelectedEngineer
return UnityEngine.AudioClip

sfxSelectedIdle public_oe property

public AudioClip,UnityEngine sfxSelectedIdle
return UnityEngine.AudioClip

sfxSelectedSaboteur public_oe property

public AudioClip,UnityEngine sfxSelectedSaboteur
return UnityEngine.AudioClip

stepDustPrefab public_oe property

public Transform stepDustPrefab
return Transform

workingMouseState public_oe property

public MouseWorldPosition.eMouseStates workingMouseState
return MouseWorldPosition.eMouseStates