/// <summary> /// Initialize all the components. /// </summary> /// <param name="agent"></param> /// <param name="source"></param> /// <returns></returns> public Skill Init(Agent agent, GameObject source) { _agent = agent; _sourceObject = source; _agentAnimation = _agent.AgentAnimation; _state = SkillState.Idling; return(this); }
/// <summary> /// Initialization of Agent's Resources component. /// </summary> /// <param name="agent"></param> public void Init(Agent agent) { _agent = agent; if (_useHealth) { _curHealthPoints = _healthPoints; } if (_useEnergy) { _curEnergyPoints = _energyPoints; } _agentAnimation = _agent.AgentAnimation; Death.Init(agent); }
/// <summary> /// Initialization of Agent's Resources component. /// </summary> /// <param name="agent"></param> public void Init(Agent agent) { _agent = agent; //Commented code because I want to set the health to _current value //if (_useHealth) _curHealthPoints = _healthPoints; //if (_useEnergy) _curEnergyPoints = _energyPoints; // if (_useIntoxication) _curIntoxicationPoints = _intoxicationPoints; // if (_useMorale) _curMoralePoints = _moralePoints; // if (_useTemperament) _curTemperamentPoints = _temperamentPoints _agentAnimation = _agent.AgentAnimation; Death.Init(agent); }
/// <summary> /// Initialize an Agent so that it has all necessary parameters for using the engine. /// </summary> /// <param name="agent"></param> public void Init(Agent agent) { _agent = agent; _motion = agent.Motion; _transform = agent.transform; _agentAnimation = agent.AgentAnimation; _lastMoveAroundDestination = agent.transform.position; if (agent.GetComponent <IAstarAI>() != null) { _starAi = agent.GetComponent <IAstarAI>(); } else { _starAi = agent.gameObject.AddComponent <AIPath>(); _starAi.height = 2f; _starAi.radius = 0.5f; } if (!agent.gameObject.GetComponent <Seeker>()) { agent.gameObject.AddComponent <Seeker>(); } if (!agent.gameObject.GetComponent <FunnelModifier>()) { agent.gameObject.AddComponent <FunnelModifier>(); } if (!agent.gameObject.GetComponent <RVOController>()) { agent.gameObject.AddComponent <RVOController>(); } if (!GameObject.FindObjectOfType <RVOSimulator>()) { new GameObject("RVOSimulator").AddComponent <RVOSimulator>(); Debug.Log("A new GameObject of type RVOSimulator has been created"); } }