Exemplo n.º 1
0
 void Update()
 {
     if (!whetherAlive)
     {
         StormGameManager.GetTheInstance().TheSnakDie();
     }
 }
Exemplo n.º 2
0
    //***************************************************************************
    //对蛇的相关操作


    private void AddOneBody()
    {
        StormGameManager.GetTheInstance().SetScore(0);

        snakeLength++;
        tSnakeBodyObj = Instantiate(snakeBodyObj, snakeTail.transform.position, snakeTail.transform.rotation) as GameObject;
        tSnakeBody    = tSnakeBodyObj.GetComponent <StormSnakeBody>();

        tSnakeBody.SetAllMemember(snakeTail, snakeLength, null);
        snakeTail.SetNextBody(tSnakeBodyObj);
        snakeTail = tSnakeBody;

        snakeBodySpriteRenderer.sortingOrder--;
        StormGameManager.GetTheInstance().SetLenText(snakeLength);
    }
Exemplo n.º 3
0
    private void Awake()
    {
        whetherAlive = true;

        theInstance     = this;
        thisRigidbody2d = GetComponent <Rigidbody2D>();

        SetStartHistoryArray();
        LoadSkinSprite();
        SetPrefabSnakeHeadAndBody();
        snakeBodySpriteRenderer.sortingOrder = 0;

        InstantiateFirstBody();

        StormGameManager.GetTheInstance().SetLenText(snakeLength);
        StormGameManager.GetTheInstance().SetSpeedText((int)(snakeSpeed));
    }
Exemplo n.º 4
0
    public void MinusOneBody()
    {
        StormGameManager.GetTheInstance().SetScore(1);
        if (snakeLength == 1)
        {
            whetherAlive = false;
            return;
        }

        snakeLength--;

        snakeTail = snakeTail.GetLastSnakeBodyStormBody();
        Destroy(snakeTail.GetNextSnakeBodyObj());
        snakeTail.SetNextBody(null);
        snakeBodySpriteRenderer.sortingOrder++;

        StormGameManager.GetTheInstance().SetLenText(snakeLength);
    }
Exemplo n.º 5
0
 public void GetOneFood()
 {
     StormGameManager.GetTheInstance().SetScore(4);
     AddOneBody();
     SoundPlayer.PlayItemsSound(0);
 }
Exemplo n.º 6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     StormGameManager.GetTheInstance().OpenWinInterface();
 }