示例#1
0
        public virtual void Awake()
        {
            thisT   = transform;
            thisObj = gameObject;

            //initiate the base stats
            if (startHitPointAtFull)
            {
                hitPoint = hitPointFull;
            }

            if (startEnergyAtFull)
            {
                energy = energyFull;
            }
            else
            {
                energy = Mathf.Clamp(energy, 0, energyFull);
            }

            currentCD = 0;

            //setup the physics
            thisCollider = thisObj.GetComponent <Collider>();
            if (anchorDown)
            {
                thisObj.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
                thisObj.GetComponent <Rigidbody>().isKinematic = true;
                moveSpeed   = 0;
                rotateSpeed = 0;
            }
            else
            {
                Rigidbody rBody = thisObj.GetComponent <Rigidbody>();
                if (rBody != null)
                {
                    rBody.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionY;
                }
            }

            //initiate the attack-stats
            attackStats.Init();
            contactAttackStats.Init();

            if (shootObject != null)
            {
                ObjectPoolManager.New(shootObject);
            }
            if (destroyedEffectObj != null)
            {
                ObjectPoolManager.New(destroyedEffectObj);
            }

            //TDSUtility.DestroyColliderRecursively(thisT);
        }
示例#2
0
        //called at the when an ability is first added to player
        public void Init()
        {
            aStats.Init();

            currentCD = 0;

            if (type == _AbilityType.Shoot && shootObject == null)
            {
                Debug.LogWarning("Ability (" + name + ") - is shoot type but no shoot object has been assigned", null);
            }
        }
示例#3
0
        [HideInInspector] public bool temporary = false;                //used for weapon that is collected via collectible, cannot switch weapon and discard when out of ammo


        void Awake()
        {
            //make sure none of the element in shootPointList is null
            for (int i = 0; i < shootPointList.Count; i++)
            {
                if (shootPointList[i] == null)
                {
                    shootPointList.RemoveAt(i);     i -= 1;
                }
            }

            //if no shoot point has been assigned, use the current transform
            if (shootPointList.Count == 0)
            {
                shootPointList.Add(transform);
            }

            if (shootObject != null)
            {
                InitShootObject();
            }

            aStats.Init();              //initiate the attack stats

            //create the ability
            ability = AbilityDB.CloneItem(abilityID);
            if (ability != null)
            {
                ability.Init();
            }

            if (shootObject != null)
            {
                ObjectPoolManager.New(shootObject, 3);
            }
            else
            {
                Debug.LogWarning("shoot object for weapon unassigned", this);
            }

            Reset();
        }