C# Class CMonkey, astrochimps

Class with monkey's definitions
Inheritance: CBaseEntity
Afficher le fichier Open project: arcoelho01/astrochimps Class Usage Examples

Méthodes publiques

Свойство 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

Méthodes publiques

Méthode 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

Méthode 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 méthode

When the script is initialized
public Awake ( ) : void
Résultat void

CapturedBy() public méthode

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
Résultat void

CientistRevealedRocketParts() public méthode

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

EnterNewState() public méthode

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

ExecuteCurrentState() public méthode

Executes the FSM current state
public ExecuteCurrentState ( ) : void
Résultat void

GetColliderInfo() public méthode

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
Résultat void

InstantiateADustCloud() public méthode

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

IsInsideAPrison() public méthode

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
Résultat bool

KillMonkey() public méthode

public KillMonkey ( ) : void
Résultat void

LeaveCurrentState() public méthode

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

LoadMinimapIcon() public méthode

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
Résultat void

LoopWalkCycle() public méthode

Manages the walk cycle loop
public LoopWalkCycle ( ) : void
Résultat void

MonkeyAttack() public méthode

public MonkeyAttack ( ) : void
Résultat void

OnAStarReachedEndOfPath() public méthode

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

OnDisable() public méthode

What to do when this object is disabled
public OnDisable ( ) : void
Résultat void

OnDrawGizmos() public méthode

Draw some helpers on screen
public OnDrawGizmos ( ) : void
Résultat void

OnEnable() public méthode

What to do when this object is enabled
public OnEnable ( ) : void
Résultat void

OnSabotageStatusChange() public méthode

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
Résultat void

PerformAction() public méthode

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
Résultat void

ReleaseMe() public méthode

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

Select() public méthode

Selected is overriden to play a sound
public Select ( ) : Transform
Résultat Transform

Update() public méthode

Update
public Update ( ) : void
Résultat void

WalkTo() public méthode

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
Résultat void

WorkIsDone() public méthode

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

getFSMCurrentState() public méthode

public getFSMCurrentState ( ) : FSMState,
Résultat FSMState,

getResearchIsComplete() public méthode

public getResearchIsComplete ( ) : bool
Résultat bool

playAckSound() public méthode

public playAckSound ( ) : void
Résultat void

playAttackAckSound() public méthode

public playAttackAckSound ( ) : void
Résultat void

playAttackSound() public méthode

public playAttackSound ( ) : void
Résultat void

playCapturedSound() public méthode

public playCapturedSound ( ) : void
Résultat void

playResearchComplete() public méthode

public playResearchComplete ( ) : void
Résultat void

playSelectedSound() public méthode

public playSelectedSound ( ) : void
Résultat void

Property Details

attackRange public_oe property

public float attackRange
Résultat float

iconPrefab public_oe property

public Transform iconPrefab
Résultat Transform

monkeyClass public_oe property

public eMonkeyType monkeyClass
Résultat eMonkeyType

sfxAckAstronaut public_oe property

public AudioClip,UnityEngine sfxAckAstronaut
Résultat UnityEngine.AudioClip

sfxAckCientist public_oe property

public AudioClip,UnityEngine sfxAckCientist
Résultat UnityEngine.AudioClip

sfxAckDefault public_oe property

public AudioClip,UnityEngine sfxAckDefault
Résultat UnityEngine.AudioClip

sfxAckEngineer public_oe property

public AudioClip,UnityEngine sfxAckEngineer
Résultat UnityEngine.AudioClip

sfxAckSaboteur public_oe property

public AudioClip,UnityEngine sfxAckSaboteur
Résultat UnityEngine.AudioClip

sfxAttackAckAstronaut public_oe property

public AudioClip,UnityEngine sfxAttackAckAstronaut
Résultat UnityEngine.AudioClip

sfxAttackAckCientist public_oe property

public AudioClip,UnityEngine sfxAttackAckCientist
Résultat UnityEngine.AudioClip

sfxAttackAckEngineer public_oe property

public AudioClip,UnityEngine sfxAttackAckEngineer
Résultat UnityEngine.AudioClip

sfxAttackAckSaboteur public_oe property

public AudioClip,UnityEngine sfxAttackAckSaboteur
Résultat UnityEngine.AudioClip

sfxAttackAstronaut public_oe property

public AudioClip,UnityEngine sfxAttackAstronaut
Résultat UnityEngine.AudioClip

sfxAttackCientist public_oe property

public AudioClip,UnityEngine sfxAttackCientist
Résultat UnityEngine.AudioClip

sfxAttackEngineer public_oe property

public AudioClip,UnityEngine sfxAttackEngineer
Résultat UnityEngine.AudioClip

sfxAttackSaboteur public_oe property

public AudioClip,UnityEngine sfxAttackSaboteur
Résultat UnityEngine.AudioClip

sfxAttacked public_oe property

public AudioClip,UnityEngine sfxAttacked
Résultat UnityEngine.AudioClip

sfxAttackedAstronaut public_oe property

public AudioClip,UnityEngine sfxAttackedAstronaut
Résultat UnityEngine.AudioClip

sfxAttackedCientist public_oe property

public AudioClip,UnityEngine sfxAttackedCientist
Résultat UnityEngine.AudioClip

sfxAttackedEngineer public_oe property

public AudioClip,UnityEngine sfxAttackedEngineer
Résultat UnityEngine.AudioClip

sfxAttackedSaboteur public_oe property

public AudioClip,UnityEngine sfxAttackedSaboteur
Résultat UnityEngine.AudioClip

sfxDying public_oe property

public AudioClip,UnityEngine sfxDying
Résultat UnityEngine.AudioClip

sfxReprogramming public_oe property

public AudioClip,UnityEngine sfxReprogramming
Résultat UnityEngine.AudioClip

sfxResearchComplete public_oe property

public AudioClip,UnityEngine sfxResearchComplete
Résultat UnityEngine.AudioClip

sfxSelectedAstronaut public_oe property

public AudioClip,UnityEngine sfxSelectedAstronaut
Résultat UnityEngine.AudioClip

sfxSelectedCientist public_oe property

public AudioClip,UnityEngine sfxSelectedCientist
Résultat UnityEngine.AudioClip

sfxSelectedDefault public_oe property

public AudioClip,UnityEngine sfxSelectedDefault
Résultat UnityEngine.AudioClip

sfxSelectedEngineer public_oe property

public AudioClip,UnityEngine sfxSelectedEngineer
Résultat UnityEngine.AudioClip

sfxSelectedIdle public_oe property

public AudioClip,UnityEngine sfxSelectedIdle
Résultat UnityEngine.AudioClip

sfxSelectedSaboteur public_oe property

public AudioClip,UnityEngine sfxSelectedSaboteur
Résultat UnityEngine.AudioClip

stepDustPrefab public_oe property

public Transform stepDustPrefab
Résultat Transform

workingMouseState public_oe property

public MouseWorldPosition.eMouseStates workingMouseState
Résultat MouseWorldPosition.eMouseStates