Пример #1
0
    void GrowUp()
    {
        if (_state == SMBConstants.PlayerState.GrownUp)
        {
            return;
        }

        SMBGameWorld.Instance.PauseGame(false);

        _animator.SetTrigger("triggerGrownUp");
        _animator.SetLayerWeight(0, 0);
        _animator.SetLayerWeight(1, 1);

        _collider.SetSize(grownUpColliderSize);

        _velocityBeforeGrowUp = _body.velocity;

        _lockController    = true;
        _body.applyGravity = false;
        _body.velocity     = Vector2.zero;

        _audio.PlayOneShot(soundEffects[(int)SoundEffects.GrowUp]);

        _state = SMBConstants.PlayerState.GrownUp;
    }
Пример #2
0
    void Die(float timeToDie, bool animate = true)
    {
        if (_isInvincible)
        {
            return;
        }

        _state = SMBConstants.PlayerState.Dead;

        _lockController = true;

        _particleSystem._shootParticles = false;

        _collider.applyHorizCollision = false;
        _collider.applyVertCollision  = false;

        gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");

        _body.velocity     = Vector2.zero;
        _body.acceleration = Vector2.zero;
        _body.applyGravity = false;

        _animator.SetTrigger("triggerDie");

        if (animate)
        {
            Invoke("PlayDeadAnimation", timeToDie);
        }
    }
Пример #3
0
    void Start()
    {
        _state = SMBConstants.PlayerState.Short;
        _particleSystem._shootParticles = false;

        _originalCollider        = _collider.GetSize();
        _originalCollider.center = Vector3.zero;
    }
Пример #4
0
    void TakeDamage()
    {
        SMBGameWorld.Instance.PauseGame(false);

        _animator.SetTrigger("triggerDamage");
        _animator.SetLayerWeight(0, 1);
        _animator.SetLayerWeight(1, 0);

        _collider.SetSize(_originalCollider);

        _lockController = true;
        _isInvincible   = true;

        _body.applyGravity    = false;
        _body.velocity        = Vector2.zero;
        _velocityBeforeGrowUp = Vector2.zero;

        _audio.PlayOneShot(soundEffects[(int)SoundEffects.GrowUp]);

        _state = SMBConstants.PlayerState.Short;
    }
Пример #5
0
    void Die(float timeToDie, bool animate = true)
    {
        isAlive = false;

        stream.WriteLine("-----------------------Died: " + Time.time + " ----------------------", true);

        outPutBeliefStack();


        //beliefStack.Push(marioBeliefArray);


        if (_isInvincible)
        {
            return;
        }

        _state = SMBConstants.PlayerState.Dead;

        _lockController = true;

        _particleSystem._shootParticles = false;

        _collider.applyHorizCollision = false;
        _collider.applyVertCollision  = false;

        gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");

        _body.velocity     = Vector2.zero;
        _body.acceleration = Vector2.zero;
        _body.applyGravity = false;

        _animator.SetTrigger("triggerDie");

        if (animate)
        {
            Invoke("PlayDeadAnimation", timeToDie);
        }
    }
Пример #6
0
    void Start()
    {
        beliefStack = new Stack <string[]>();

        marioBeliefArray    = new string[4];
        marioBeliefArray[0] = Agent;
        marioBeliefArray[1] = Action;
        marioBeliefArray[2] = Interaction;
        marioBeliefArray[3] = Result;

        //https://answers.unity.com/questions/185268/adding-a-box-collider-to-an-object-in-csharp-scrip.html
        gameObject.AddComponent <CircleCollider2D>();
        circleCollider           = GetComponent <CircleCollider2D>();
        circleRadius             = 1;
        circleCollider.radius    = circleRadius;
        circleCollider.isTrigger = true;

        string path    = "Assets/Scripts/Utils/newCoordinates.txt";
        string newPath = "Assets/Scripts/Utils/withCounter.txt";

        stream = new StreamWriter(path, true);
        stream.WriteLine("Start Time: " + Time.time);

        //streamReader = new StreamReader(newPath, true);

        counterStream = new StreamWriter(newPath, true);
        //counterStream.WriteLine("Start Time: " + Time.time);

        //makes it so the player starts out as the tiny mario
        _state = SMBConstants.PlayerState.Short;

        //no particles shot
        _particleSystem._shootParticles = false;


        _originalCollider        = _collider.GetSize();
        _originalCollider.center = Vector3.zero;
    }