コード例 #1
0
        //temp
        private void DetermineDrop(DropType t)
        {
            switch (t)
            {
            case DropType.HEAL:
                int temp = healthCurrent + 25;
                healthCurrent       = temp > healthMax ? healthMax : temp;
                healthUI.localScale = new Vector3(1f, (float)healthCurrent / (float)healthMax, 1f);
                break;

            case DropType.HEALTH:
                break;

            case DropType.MOVEMENTSPEED:
                //could work...
                movementSpeed = UpgradesController.Instance.GetMovementValue(++playerInfo.levelMovementSpeed);
                CoroutineEX.Delay(this, () => movementSpeed = UpgradesController.Instance.GetMovementValue(--playerInfo.levelMovementSpeed), 5f);
                break;

            case DropType.FIRERATE:
                bullet.AdjustFireRate(UpgradesController.Instance.GetFireRateValue(++playerInfo.levelFireRate));
                CoroutineEX.Delay(this, () => bullet.AdjustFireRate(UpgradesController.Instance.GetFireRateValue(--playerInfo.levelFireRate)), 5f);
                break;

            case DropType.ARMOUR:
                break;

            default:
                break;
            }
        }
コード例 #2
0
        protected virtual void OnEnable()
        {
            //get target
            if (target == null)
            {
                target = GameObject.FindGameObjectWithTag("Player").transform;
            }

            //get child triggers
            ChildTrigger[] ct = GetComponentsInChildren <ChildTrigger>();
            foreach (ChildTrigger c in ct)
            {
                //Debug.Log("Child Trigger Assigned");
                c.TRIGGER += () => gameObject.SetActive(false);
            }

            //face random direction
            transform.rotation = Quaternion.AngleAxis(UnityEngine.Random.Range(0f, 360f), transform.up) * transform.rotation;
            //start movement delay
            isActive = false;
            CoroutineEX.Delay(this, () => isActive = true, timeWait);
        }