// Use this for initialization protected virtual void Start() { model = GetComponent <GenericShipModel>(); view = GetComponent <GenericShipView>(); _myDetector = GetComponent <SphereDetector>(); if (_myDetector == null) { Debug.LogError("No Detector attached to " + gameObject + "!"); } // Check if initial state is specified. If not, and there is no waypoint manager, then begin in square patrol mode. // Otherwise, begin in waypoint patrol mode. if (_startState == GenericShipAiState.Idle && _waypointManager == null) { _currentState = GenericShipAiState.SquarePatrolling; } if (_startState == GenericShipAiState.Idle && _waypointManager != null) { _currentState = GenericShipAiState.WaypointPatrolling; } // If we are patrolling and have no waypoints, then begin patrolling in square formation. if (_currentState == GenericShipAiState.SquarePatrolling) { StartCoroutine(SquareFormationPatrol()); } // Begin custom update loop for AI. InvokeRepeating(nameof(UpdateAiController), 0.0f, _behaviorChangeRate); }
virtual protected void Start() { myModel = GetComponent <GenericShipModel>(); myAnimator = GetComponent <Animator>(); if (myAnimator == null) { Debug.LogError("No animator attached to PlayerShip!"); } myAudio = GetComponent <AudioSource>(); }
// Use this for initialization protected virtual void Start() { myShipModel = GetComponent<GenericShipModel>(); myShipView = GetComponent<GenericShipView>(); myDetector = GetComponent<Detector>(); myController = GetComponent<BaseAIController>(); if (myDetector == null) { Debug.LogError("No Detector attached to " + gameObject + "!"); } if (myController == null) { Debug.LogError("No AI Controller attached to " + gameObject + "!"); } myController.SetAIControl(true); myShipView.setAIControlled(true); // Begin custom update loop for AI. InvokeRepeating("UpdateAIController", 0.0f, behaviorChangeRate); }
protected virtual void Start() { myDetector = GetComponent<Detector2D>(); myModel = GetComponent<GenericShipModel>(); myAnimator = GetComponent<Animator>(); if (myAnimator == null) { Debug.LogError("No animator attached to PlayerShip!"); } myFaction = GetComponent<Faction>(); if (myFaction != null) { if (myShooter != null) myShooter.SetWeaponFaction(myFaction.FactionName); if (mySecondaryShooter != null) mySecondaryShooter.SetWeaponFaction(myFaction.FactionName); } myAudio = GetComponent<AudioSource>(); // Set the current position as the desired destination destinationInput = transform.position; }
protected virtual void Start() { myShip = GetComponent <GenericShipModel>(); }