Exemplo n.º 1
0
        void Start()
        {
            //get the ame manager script
            GameMgr   = GameManager.Instance;
            MvtMgr    = MovementManager.Instance;
            AttackMgr = AttackManager.Instance;

            //default values for the timers:
            AttackTimer = 0.0f;
            SearchTimer = 0.0f;

            ObjPool = EffectObjPool.Instance;

            if (AttackAllTypes == false)
            { //if it can not attack all the units
                AttackMgr.AssignAttackExceptions(AttackExceptions, ref AttackExceptionList);
            }

            //if there's a weapon object:
            if (WeaponObj)
            {
                WeaponIdleRotation.eulerAngles = WeaponIdleAngles;
            }

            //get the range type ID from the attack manager
            RangeTypeID = AttackMgr.GetRangeTypeID(RangeType);
        }
Exemplo n.º 2
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(this);
     }
 }
Exemplo n.º 3
0
        // Use this for initialization
        void Start()
        {
            DidDamage = false;

            //Settings in order to make OnCollisionEnter work:
            GetComponent <Collider> ().isTrigger    = false;
            GetComponent <Rigidbody> ().isKinematic = false;
            GetComponent <Rigidbody> ().useGravity  = false;

            ObjPool = EffectObjPool.Instance;
        }
Exemplo n.º 4
0
        // Use this for initialization
        void Start()
        {
            DidDamage = false;

            //Settings in order to make OnCollisionEnter work:
            GetComponent <Collider>().isTrigger    = false;
            GetComponent <Rigidbody>().isKinematic = false;
            GetComponent <Rigidbody>().useGravity  = false;

            ObjPool = EffectObjPool.Instance;

            SourceObj = Source.gameObject; //store the source game object here in case it's destroyed before the attack object hits the enemy.
        }
Exemplo n.º 5
0
            //a method that launches the attack object towards the target
            public void Launch(EffectObjPool effectPool, AttackEntity source)
            {
                AttackObject newAttackObject = effectPool.SpawnEffectObj(attackObject, launchPosition.position, Quaternion.identity).GetComponent <AttackObject>();

                Vector3 targetPosition = source.GetTargetPosition();

                if (GameManager.MultiplayerGame == false) //if this is a singleplayer game, we can play with accuracy:
                {
                    targetPosition += new Vector3(Random.Range(-accuracyModifier.x, accuracyModifier.x), Random.Range(-accuracyModifier.y, accuracyModifier.y), Random.Range(-accuracyModifier.z, accuracyModifier.z));
                }

                newAttackObject.Enable(source, targetPosition,
                                       (createInDelay == true) ? delayTime : 0.0f,
                                       damageInDelay,
                                       delayParentObject,
                                       source.CanEngageFriendly());
            }
Exemplo n.º 6
0
        void Start()
        {
            //get the ame manager script
            GameMgr = GameManager.Instance;

            //default values for the timers:
            AttackTimer = 0.0f;
            SearchTimer = 0.0f;

            ObjPool = EffectObjPool.Instance;

            //Unit only:
            if (Attacker == Attackers.Unit)
            {
                if (UnitMgr.NavAgent != null)
                {
                    //If the min unit/building attacking distance is smaller than the nav mesh agent diameter then it would be impossible for the unit to reach its target, so we set it to the minimal possible value:
                    if (MinUnitStoppingDistance < UnitMgr.NavAgent.radius * 2)
                    {
                        MinUnitStoppingDistance = UnitMgr.NavAgent.radius * 2;
                    }
                    if (MinBuildingStoppingDistance < UnitMgr.NavAgent.radius * 2)
                    {
                        MinBuildingStoppingDistance = UnitMgr.NavAgent.radius * 2;
                    }
                }
            }

            if (AttackAllTypes == false)               //if it can not attack all the units
            {
                AttackManager.Instance.AssignAttackCategories(AttackCategories, ref AttackCategoriesList);
            }

            //if there's a weapon object:
            if (WeaponObj)
            {
                WeaponIdleRotation.eulerAngles = WeaponIdleAngles;
            }
        }
Exemplo n.º 7
0
        void Start()
        {
            //get the ame manager script
            GameMgr   = GameManager.Instance;
            MvtMgr    = MovementManager.Instance;
            AttackMgr = AttackManager.Instance;

            //default values for the timers:
            AttackTimer = 0.0f;
            SearchTimer = 0.0f;

            ObjPool = EffectObjPool.Instance;

            //if there's a weapon object:
            if (WeaponObj)
            {
                WeaponIdleRotation.eulerAngles = WeaponIdleAngles;
            }

            //get the range type ID from the attack manager
            RangeTypeID = AttackMgr.GetRangeTypeID(RangeType);
        }