コード例 #1
0
ファイル: Skizzard.cs プロジェクト: Benedict-SC/doom-dial
    public void OnRevolution()
    {
        if (currentState == state.MOVING)        //start a dive if a dive isn't already in progress
        {
            currentState = state.DIVING;
            radii.y      = -0.2f;
            radii.z      = -diveAcc;
        }

        if (mode >= 1)        //gain speed
        {
            if (thetas.y < maxSpeed)
            {
                thetas.y += speedPerRevolution;
                if (thetas.y > maxSpeed)
                {
                    thetas.y = maxSpeed;
                }
            }
        }
        if (mode >= 2)        //enemies gain speed
        {
            List <Enemy> enemylist = Dial.GetAllEnemies();
            foreach (Enemy e in enemylist)
            {
                GameObject zappything = GameObject.Instantiate(Resources.Load("Prefabs/MainCanvas/ZappyThing")) as GameObject;
                zappything.GetComponent <RectTransform>().sizeDelta = e.GetComponent <RectTransform>().sizeDelta * 1.7f;
                zappything.GetComponent <Lifespan>().BeginLiving(3f);
                zappything.GetComponent <Lifespan>().SetImageToFade(true);
                zappything.transform.SetParent(e.transform, false);

                e.SpeedUp(enemyBoostMultiplier, enemyBoostDuration);
            }
        }
        if (mode >= 3)        //gain life drain
        {
            lifeDrain += lifeDrainPerRevolution;
        }
    }