コード例 #1
0
    // Use this for initialization
    void Awake()
    {
        _healthBar   = gameObject.GetComponentInChildren <HealthBar>(true);
        _audioSource = GetComponent <AudioSource>();

        //If we have to add multiple text boxes then we will need this script to sort through them and select the proper textbox
        Text[] textBoxes = gameObject.GetComponentsInChildren <Text>(true);
        if (textBoxes != null)
        {
            foreach (Text text in textBoxes)
            {
                if (text.gameObject.name == "PlayerHealthText")
                {
                    _healthText = text;
                    break;
                }
            }
        }

        PVPSprite[] pvpSprites = gameObject.GetComponentsInChildren <PVPSprite>(true);
        if (pvpSprites != null)
        {
            foreach (PVPSprite x in pvpSprites)
            {
                if (x.gameObject.name == "PVP1")
                {
                    _pvp1 = x;
                }
                else if (x.gameObject.name == "PVP2")
                {
                    _pvp2 = x;
                }
            }
        }

        _activeSpriteScript = null;
        _currentJumpState   = PlayerSpriteJumpState.None;
        SetJumpStartPositions();
        _characterSpriteEndPosition = new Vector3(ButtonX, ButtonY, 1);
    }
コード例 #2
0
    public void MakeAttack(AttackStats attackStats, System.Action sendPressNotification)
    {
        SendPressNotification = sendPressNotification;

        //Attack consists of:
        //1a. One player jumps, translating in an arc towards a button in the center of the screen over the course of 0.5s
        //1b. The player sprite enters the jump animation.
        //1c. A jump noise is played.
        //2a. The player sprite lands and stops translating.
        //2b. The player sprite transitions from jump animation to landing animation.
        //2c. A landing sound is played.
        //3a. The player jumps back, translating in an arc over 0.5s.
        //3b. The player sprite enters the jump animation.
        //3c. (No jump sound)
        //4a. The player sprite lands and stops translating.
        //4b. The player sprite transitions from jump animation to idle animation.

        PlayerSprite player;
        PVPSprite    spriteScript;

        if (UnityEngine.Random.Range(0, 2) == 1)
        {
            player       = PlayerSprite.PVP1;
            spriteScript = _pvp1;
        }
        else
        {
            player       = PlayerSprite.PVP2;
            spriteScript = _pvp2;
        }

        _activeSpriteScript          = spriteScript;
        _activePlayerSpriteTransform = GetPlayerSpriteTransform(player);

        StartAttackJumpTranslation(player);
        PlayJumpNoise();
    }
コード例 #3
0
 void EndJumpAnimation(PVPSprite spriteScript)
 {
     spriteScript.Land();
 }
コード例 #4
0
 void StartJumpAnimation(PVPSprite spriteScript)
 {
     //Doesn't do shit. Need to add this once we have created a jump animation clip.
     spriteScript.Jump();
 }