Esempio n. 1
0
    void Prepare()
    {
        if (GameController.Instance.state != GameState.Preparation)
        {
            this.rigidbody.gravityScale = 1;
            return;
        }
        if (action)
        {
            Destroy(action);
        }

        var rand = Random.Range(0, 4);

        if (gauge >= 100f)
        {
            if (rand <= 1)
            {
                rand += Random.Range(0, ((int)gauge / 100) % 3);
            }
        }

        ActionCards card = (ActionCards)rand;

        switch (card)
        {
        case ActionCards.Neutral:
            action = this.gameObject.AddComponent <NeutralAction>();
            break;

        case ActionCards.Guard:
            action = this.gameObject.AddComponent <GuardAction>();
            break;

        case ActionCards.Focus:
            action = this.gameObject.AddComponent <FocusAction>();
            break;

        case ActionCards.Special:
            action = this.gameObject.AddComponent <SpecialAction>();
            break;

        default:
            return;
        }
    }
Esempio n. 2
0
    void Generate()
    {
        var rand = Random.Range(0, 4);

        RandomizeDirection();
        if (GameController.Instance.gauge >= 100f)
        {
            moveSpeed = initialMoveSpeed * (GameController.Instance.gauge / 100);
            if (rand <= 1)
            {
                rand += Random.Range(0, ((int)GameController.Instance.gauge / 100) % 3);
            }
        }
        action = (ActionCards)rand;

        switch (action)
        {
        case ActionCards.Neutral:
            GetComponent <SpriteRenderer>().sprite = cardN;
            break;

        case ActionCards.Focus:
            GetComponent <SpriteRenderer>().sprite = cardF;
            break;

        case ActionCards.Special:
            GetComponent <SpriteRenderer>().sprite = cardS;
            break;

        case ActionCards.Guard:
            GetComponent <SpriteRenderer>().sprite = cardG;
            break;

        default:
            break;
        }
    }