示例#1
0
    private bool DropRocket(EnemyRocket.type type)
    {
        EnemyRocket rocket    = prefab.GetInstance(type);
        bool        isNotNull = (rocket != null);

        if (isNotNull)
        {
            Vector2 source = new Vector2(Random.Range(-width, width), spawnY);
            Vector2 target = targets[Random.Range(0, targets.Count)];
            rocket.transform.position = source;
            rocket.transform.rotation = Quaternion.FromToRotation(Vector2.down, target - source);
            rocket.Launch(target);
        }
        return(isNotNull);
    }
示例#2
0
    public int IncreaseScore(EnemyRocket.type type)
    {
        int amount;

        if (type == EnemyRocket.type.FAT)
        {
            amount = fatRocketValue;
            fatScoreCount++;
        }
        else
        {
            amount = thinRocketValue;
            thinScoreCount++;
        }
        levelScore         += amount;
        totalScore         += amount;
        totalScoreText.text = totalScore.ToString();
        return(amount);
    }
示例#3
0
    public void UpdateCount(EnemyRocket.type type, int amount)
    {
        Text count = (type == EnemyRocket.type.FAT ? fatIncomingText : thinIncomingText);

        count.text = amount.ToString();
    }