Beispiel #1
0
 void Start()
 {
     orochi = new Orochi()
     {
         Attack = 10, HP = 1500, Cridamage = 20
     };
     firebird = new Firebird()
     {
         Attack = 15, HP = 1200, Cridamage = 45
     };
     poison = new Poison()
     {
         image = imgpoison, speed = 100.0f
     };
     fire = new Fire()
     {
         image = imgfire, speed = 100.0f
     };
     posionAD = new PosionAD()
     {
         image = imgposionAD
     };
     posionCD = new PosionCD()
     {
         image = imgpoisonCD
     };
     fireAD = new FireAD()
     {
         image = imgfireAD
     };
     fireCD = new FireCD()
     {
         image = imgfireCD
     };
     sword = new Sword()
     {
         image = imgsword, speed = 60.0f
     };
     wow = new Wow()
     {
         image = imgwow
     };
     wscreen = new Wscreen()
     {
         image = imgwscreen, speed = 1.0f
     };
 }
Beispiel #2
0
    //。。。。。


    //两个boss战斗
    public void Fightstate(ref Orochi orochi, ref Firebird firebird)
    {
        fightTime += Time.deltaTime;
        switch (fightcurrentState)
        {
        case FightState.FirebirdState_attack:
        {
            wscreen.image.color = new Color(1, 1, 1, 0.0f);
            wow.image.color     = new Color(1, 1, 1, 0.0f);
            if (fightTime < 2.0f)
            {
                posionAD.image.color = new Color(1, 1, 1, 0.0f);
                posionCD.image.color = new Color(1, 1, 1, 0.0f);
                fireAD.image.color   = new Color(1, 1, 1, 0.0f);
                fireCD.image.color   = new Color(1, 1, 1, 0.0f);
                fire.image.color     = new Color(1, 1, 1, 1.0f);
                poison.image.color   = new Color(1, 1, 1, 0.0f);
                fire.image.rectTransform.position -= new Vector3(Time.deltaTime * fire.speed, Time.deltaTime * fire.speed, 0.0f);
            }
            if (fightTime > 2.0f)
            {
                fire.image.color = new Color(1, 1, 1, 0.0f);
                if (Random.Range(0, 100) <= 30)
                {
                    //firebird.Attack = firebird.Cridamage;
                    orochi.HP     = orochi.HP - firebird.Cridamage;
                    orochihp.text = "HP:" + orochi.HP.ToString();

                    fireCD.image.color = new Color(1, 1, 1, 1.0f);        //如何能让这个伤害图片停留的时间长一点?
                    //Bossdamage(ref fireCD);想写个单独的状态,但是不知道放哪里能超脱这个fighttime控制

                    Debug.Log("烈焰火鸟造成暴击伤害" + firebird.Cridamage);
                    Debug.Log("八岐大蛇剩余血量" + orochi.HP);
                }
                else
                {
                    orochi.HP          = orochi.HP - firebird.Attack;
                    orochihp.text      = "HP:" + orochi.HP.ToString();
                    fireAD.image.color = new Color(1, 1, 1, 1.0f);        //如何能让这个伤害图片停留的时间长一点?

                    Debug.Log("烈焰火鸟造成普通伤害" + firebird.Attack);
                    Debug.Log("八岐大蛇剩余血量" + orochi.HP);
                }
                fightcurrentState = FightState.OrochiState_attack;
                fire.image.rectTransform.localPosition = new Vector3(241.0f, 231.0f, 0.0f);
                fightTime = 0.0f;
            }
        }
        break;

        case FightState.OrochiState_attack:
        {
            wscreen.image.color = new Color(1, 1, 1, 0.0f);
            wow.image.color     = new Color(1, 1, 1, 0.0f);
            if (fightTime < 2.0f)
            {
                posionAD.image.color = new Color(1, 1, 1, 0.0f);
                posionCD.image.color = new Color(1, 1, 1, 0.0f);
                fireAD.image.color   = new Color(1, 1, 1, 0.0f);
                fireCD.image.color   = new Color(1, 1, 1, 0.0f);
                poison.image.color   = new Color(1, 1, 1, 1.0f);
                poison.image.rectTransform.position += new Vector3(Time.deltaTime * poison.speed, Time.deltaTime * poison.speed, 0.0f);
            }
            if (fightTime > 2.0f)
            {
                poison.image.color = new Color(1, 1, 1, 0.0f);
                if (Random.Range(0, 100) <= 50)
                {
                    //orochi.Attack = orochi.Cridamage;
                    firebird.HP          = firebird.HP - orochi.Cridamage;
                    firebirdhp.text      = "HP:" + firebird.HP.ToString();
                    posionCD.image.color = new Color(1, 1, 1, 1.0f);        //如何能让这个伤害图片停留的时间长一点?

                    Debug.Log("八岐大蛇造成暴击伤害" + orochi.Cridamage);
                    Debug.Log("烈焰火鸟剩余血量" + firebird.HP);
                }
                else
                {
                    firebird.HP          = firebird.HP - orochi.Attack;
                    firebirdhp.text      = "HP:" + firebird.HP.ToString();
                    posionAD.image.color = new Color(1, 1, 1, 1.0f);        //如何能让这个伤害图片停留的时间长一点?

                    Debug.Log("八岐大蛇造成普通伤害" + orochi.Attack);
                    Debug.Log("烈焰火鸟剩余血量" + firebird.HP);
                }

                fightcurrentState = FightState.FirebirdState_attack;
                poison.image.rectTransform.localPosition = new Vector3(-20.0f, 30.0f, 0.0f);        //为什么无法回到我定义的坐标?
                fightTime = 0.0f;
            }
        }
        break;
        }
    }