PlayDefault() публичный Метод

public PlayDefault ( ) : void
Результат void
Пример #1
0
    public void SetOnFire()
    {
        if (state == State.Dead)
        {
            return;
        }

        string     fireName = "Soliders/Other/SoliderFire";
        GameObject go       = (GameObject)Instantiate(Resources.Load(fireName));

        go.transform.parent           = body.transform;
        go.transform.localPosition    = new Vector3(0, 0, -2);
        go.transform.localEulerAngles = Vector3.zero;
        go.transform.localScale       = Vector3.one;

        exSpriteAnimation fireAnim = go.GetComponent <exSpriteAnimation>();

        fireAnim.PlayDefault();

        Destroy(go, 2);
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (WarSceneController.isGamePause)
        {
            return;
        }

        if (WarSceneController.state == WarSceneController.State.Beginning ||
            WarSceneController.state == WarSceneController.State.Menu ||
            WarSceneController.state == WarSceneController.State.End ||
            WarSceneController.state == WarSceneController.State.Assault)
        {
            return;
        }

        if (state == 0)
        {
            Vector3 pos = transform.localPosition;

            pos.x += speed * Time.deltaTime;
            if (pos.x >= WarSceneController.manPosMaxX - 100 || pos.x <= -WarSceneController.manPosMaxX + 100 ||
                Mathf.Abs(pos.x - orgPosX) > 1000)
            {
                Destroy(gameObject);
                return;
            }
            transform.localPosition = pos;

            int locationX = warCtrl.GetLocationPositionX(transform.localPosition.x);
            int locationY = warCtrl.GetLocationPositionY(transform.localPosition.y);
//			int locationX = (int)((pos.x + WarSceneController.manPosMaxX) / WarSceneController.locationStepX);
//			int locationY = (int)((pos.y + WarSceneController.manPosMaxY) / WarSceneController.locationStepY);

            if (warCtrl.GetLocationIsEnemy(side, locationX, locationY))
            {
                WarSceneController.Direction dir = WarSceneController.Direction.Left;
                if (speed > 0)
                {
                    dir = WarSceneController.Direction.Right;
                }
                if (warCtrl.OnSoliderHitChecking(side, type, dir, 1, locationX, locationY))
                {
                    Destroy(gameObject);
                }
                else
                {
                    state = 1;
                    anim.PlayDefault();
                }
            }
        }
        else
        {
            timeTick += Time.deltaTime;
            transform.localPosition = new Vector3(transform.localPosition.x - speed / 5 * Time.deltaTime,
                                                  transform.localPosition.y + upspeed * Time.deltaTime, transform.localPosition.z);
            if (timeTick < 0.5f)
            {
                sprite.color = new Color(1, 1, 1, 1 - 2 * timeTick);
            }
            else
            {
                Destroy(gameObject);
            }
        }
    }
Пример #3
0
    bool OnDamage(int d, int type)
    {
        if (state == State.Dead || state == State.Magic)
        {
            return(false);
        }

        bool flag = true;

        if (type == 0)
        {
            int difference = 0;
            if (side == WarSceneController.WhichSide.Left)
            {
                difference = Informations.Instance.GetGeneralInfo(WarSceneController.rightGeneralIdx).strength
                             - Informations.Instance.GetGeneralInfo(WarSceneController.leftGeneralIdx).strength;
            }
            else
            {
                difference = Informations.Instance.GetGeneralInfo(WarSceneController.leftGeneralIdx).strength
                             - Informations.Instance.GetGeneralInfo(WarSceneController.rightGeneralIdx).strength;
            }
            difference = Mathf.Clamp(difference, -20, 20);
            if (Random.Range(0, 100) > 60 + difference)
            {
                flag = false;
            }
        }
        else if (type == 1)
        {
            if (Random.Range(0, 100) > 70 - gInfo.strength / 5)
            {
                flag = false;
            }
        }
        else if (type == -1)
        {
            flag = true;
        }

        if (!flag)
        {
            if (!isFighting)
            {
                isParrying = true;
                timeParry  = 0.2f;

                head.Stop();
                body.Stop();
                horse.Stop();

                head.SetFrame("Misc", 2);
                body.SetFrame("Misc", 2);
                horse.SetFrame("Idle", 0);

                SoundController.Instance.PlaySound3D("00035", transform.position);
            }
            return(false);
        }

        SoundController.Instance.PlaySound3D("00036", transform.position);

        gInfo.healthCur -= d;
        if (gInfo.healthCur <= 0)
        {
            gInfo.healthCur = 0;

            if (state == State.Escape)
            {
                transform.localScale = new Vector3(-transform.localScale.x,
                                                   transform.localScale.y, transform.localScale.z);
            }

            horse.transform.localScale = new Vector3(-horse.transform.localScale.x,
                                                     horse.transform.localScale.y, horse.transform.localScale.z);
            horse.transform.parent = transform.parent;
            horse.Play("Run");

            head.Stop();
            body.Stop();
            head.SetFrame("Dead", 0);
            body.SetFrame("Dead", 0);
            head.transform.localPosition += deadBodyOffset;
            body.transform.localPosition += deadBodyOffset;

            weapon.gameObject.SetActive(true);
            weapon.transform.localPosition += weaponOffset;
            weapon.PlayDefault();

            state    = State.Dead;
            timeTick = 0;

            warCtrl.OnGeneralDead(side);
        }
        else
        {
            if (!isFighting)
            {
                isHited = true;

                head.Play("Hit");
                body.Play("Hit");
                horse.Stop();
                horse.SetFrame("Idle", 0);
            }
        }

        return(true);
    }
Пример #4
0
 void WaitForPlayAnim()
 {
     anim.PlayDefault();
 }