Exemple #1
0
 private void TutorialUpdate()
 {
     if (BattleMgr.mainTimer > 0f && BattleMgr.mainTimer < 1f)
     {
         var c = imgs[0].color;
         c.a          += 0.05f;
         imgs[0].color = c;
         imgs[1].color = c;
     }
     else if (BattleMgr.mainTimer > 3f && BattleMgr.mainTimer < 5f)
     {
         var c = imgs[0].color;
         c.a          -= 0.05f;
         imgs[0].color = c;
         imgs[1].color = c;
     }
     else if (BattleMgr.mainTimer > 7f && BattleMgr.mainTimer < 8f)
     {
         if (!s1)
         {
             s1 = true;
             BattleMgr.DropPause(new int[] { 0 }, new Vector3(0f, 5f, 0f));
         }
         if (BattleMgr.pDeck.Count <= 0)
         {
             if (BattleMgr.showingHelp)
             {
                 Color c = new Color(1, 1, 1, 0);
                 imgs[2].color = c;
                 imgs[3].color = c;
             }
             else
             {
                 Color c = new Color(1, 1, 1, 1);
                 imgs[2].color = c;
                 imgs[3].color = c;
             }
         }
         else
         {
             Color c = new Color(1, 1, 1, 0);
             imgs[2].color = c;
             imgs[3].color = c;
         }
     }
     else if (BattleMgr.mainTimer >= 10f && BattleMgr.mainTimer < 10.3f)
     {
         BattleMgr.turnMaxTime = 20f;
         if (BattleMgr.gamePause)
         {
             if (BattleMgr.showingHelp || BattleMgr.cSelecting.Count > 0)
             {
                 Color c = Color.yellow;
                 c.a           = 0;
                 imgs[4].color = c;
                 imgs[5].color = c;
             }
             else
             {
                 Color c = Color.yellow;
                 c.a           = 1;
                 imgs[4].color = c;
                 imgs[5].color = c;
             }
         }
         else
         {
             BattleMgr.weapon          = 0;
             BattleMgr.playerHandLimit = 3;
             Color c = Color.yellow;
             c.a           = 0;
             imgs[4].color = c;
             imgs[5].color = c;
         }
     }
     else if (BattleMgr.mainTimer > 10.5f && BattleMgr.mainTimer < 12f)
     {
         var c = imgs[6].color;
         c.a          += 0.05f;
         imgs[6].color = c;
     }
     else if (BattleMgr.mainTimer > 14f && BattleMgr.mainTimer < 16f)
     {
         var c = imgs[6].color;
         c.a          -= 0.05f;
         imgs[6].color = c;
     }
     else if (BattleMgr.mainTimer > 28f && BattleMgr.mainTimer < 29f && !BattleMgr.gamePause)
     {
         Color c = Color.white;
         c.a           = 0;
         imgs[0].color = c;
         imgs[1].color = c;
         imgs[2].color = c;
         imgs[3].color = c;
         imgs[4].color = c;
         imgs[5].color = c;
         imgs[6].color = c;
         if (BattleMgr.activeUnits.Count > 0)
         {
             BattleMgr.mainTimer -= Time.deltaTime;
             BattleMgr.turnTimer += Time.deltaTime;
         }
     }
     if (BattleMgr.turn == 4 && BattleMgr.turnTimer <= 0)
     {
         BattleMgr.turnMaxTime = 40f;
     }
 }
    // 通用死亡处理
    private void Kill(int type)

    {
        BattleMgr.activeUnits.Remove(gameObject);
        var scale = gameObject.transform.localScale;

        gameObject.tag        = "Dead";
        gameObject.layer      = 13;
        body.gameObject.tag   = "Dead";
        body.gameObject.layer = 13;
        deadtime = Time.time;
        dead     = true;

        switch (type)
        {
        case 1:
            foreach (var c in GetComponentsInChildren <Transform>())
            {
                c.parent = gameObject.transform;
                if (c.gameObject.name == "Core" || c.gameObject.name == "RotateCenter")
                {
                    c.gameObject.GetComponent <Animator>().enabled = false;
                    c.gameObject.tag   = "Dead";
                    c.rotation         = Quaternion.identity;
                    c.gameObject.layer = 0;
                }
                else if (c.gameObject.name == "SubCube")
                {
                    c.gameObject.GetComponent <Renderer>().material.SetColor("_Color", new Color(0.2f, 0.2f, 0.2f, 0.5f));
                    c.gameObject.GetComponent <SelfRotation>().enabled = false;
                    var pos = c.gameObject.transform.position;
                    pos.x     += Random.Range(-0.5f, 0.5f);
                    pos.y     += Random.Range(-0.5f, 0.5f);
                    c.position = pos;
                    c.tag      = "Dead";

                    c.rotation         = Quaternion.identity;
                    c.gameObject.layer = 0;
                }
            }
            BattleMgr.DropPause(new int[] { 1, 1, 1 }, transform.position);
            break;

        case 2:
            scale.z = 1.0f;
            gameObject.transform.localScale = scale;
            break;

        case 3:
            scale.z = 1.0f;
            gameObject.transform.localScale = scale;
            break;

        case 4:
            scale.z = 1.0f;
            gameObject.transform.localScale = scale;
            break;

        case 5:
            GetComponent <AudioSource>().Play();
            switch (BattleMgr.tPhase)
            {
            case 0:
                BattleMgr.DropPause(new int[] { 0, 11, 9 }, transform.position);
                break;

            case 1:
                BattleMgr.DropPause(new int[] { 11, 11, 13 }, transform.position);
                break;

            case 2:
                BattleMgr.DropPause(new int[] { 0, 0, 0 }, transform.position);
                break;

            case 4:
                BattleMgr.DropPause(new int[] { 10, 1 }, transform.position);
                break;

            case 5:
                BattleMgr.DropPause(new int[] { 11, 0 }, transform.position);
                break;

            case 7:
                BattleMgr.DropPause(new int[] { 1, 11, 1 }, transform.position);
                break;

            case 8:
                BattleMgr.DropPause(new int[] { 0, 0, 0 }, transform.position);
                break;

            case 9:
                BattleMgr.DropPause(new int[] { 12 }, transform.position);
                break;

            case 10:
                BattleMgr.DropPause(new int[] { 1, 4, 12 }, transform.position);
                break;

            case 11:
                BattleMgr.DropPause(new int[] { 1, 1, 0 }, transform.position);
                break;
            }
            BattleMgr.tPhase++;
            body.transform.rotation = Quaternion.identity;
            break;

        case 0:
        default:
            break;
        }

        gameObject.GetComponent <Collider>().isTrigger = true;
        bodymat.SetColor("_Color", new Color(0.2f, 0.2f, 0.2f, 1f));
        gameObject.transform.rotation = Quaternion.identity;
        body.transform.rotation       = Quaternion.identity;
        foreach (ParticleSystem ps in weapons)
        {
            var e = ps.emission;
            e.enabled = false;
        }
        if (body.GetComponent <SelfRotation>() != null)
        {
            body.GetComponent <SelfRotation>().enabled = false;
        }
    }