Ejemplo n.º 1
0
        /// <summary>
        /// Create a temporary game object and invoke the Skill from it.
        /// </summary>
        private void InvokeSkillNewGameObject()
        {
            var go = new GameObject("__skill__");

            go.transform.position = SkillOrigin.Value.transform.position;
            go.transform.rotation = SkillOrigin.Value.transform.rotation;
            var agent = Agent.AddAgentComponent(go, true);

            agent.AddSkill(Skill);
            agent.Skill(Skill.name, true)();
            agent.StartCoroutine(DestroyIn(Skill.LifeTime(), go));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Invoke Skill from the object.
        /// </summary>
        private void InvokeSkillGetAgent()
        {
            Agent agent;

            if (Owner.gameObject.GetComponent <Agent>())
            {
                agent = Owner.gameObject.GetComponent <Agent>();
            }
            else
            {
                agent = Agent.AddAgentComponent(Owner.gameObject, true);
            }

            if (agent.Skills.Contains(Skill))
            {
                agent.Skill(Skill.name, true)();
            }
            else if (ForceInvoke)
            {
                agent.AddSkill(Skill);
                agent.Skill(Skill.name, true)();
            }
        }