//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;
            }
        }
Example #2
0
        public override void Move()
        {
            base.Move();

            if (isJump)
            {
                jumpTime += Time.fixedDeltaTime;
                float jumpPosition = PhysicsEX.Jump(jumpTime, jumpForce, gravity);
                if (jumpPosition < 0)
                {
                    jumpPosition = 0f;
                    isJump       = false;
                    c            = null;
                    c            = CoroutineEX.RandomDelay(this, SetJump, delayMin, delayMax);
                }

                body.localPosition = Vector3.up * jumpPosition;
            }
        }
Example #3
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);
        }
Example #4
0
 protected override void OnEnable()
 {
     base.OnEnable();
     jumpTime = 0f;
     c        = CoroutineEX.RandomDelay(this, SetJump, delayMin, delayMax);
 }
        protected override void Start()
        {
            base.Start();

            c = CoroutineEX.RandomDelay(this, SetRotation, 0f, 5f);
        }