Пример #1
0
    public void Revert()
    {
        // Depending on vales chosen to reset, reset variables
        if (_resetPosition)
        {
            _transform.position = _position;
        }
        if (_resetRotation)
        {
            _transform.rotation = _rotation;
        }
        if (_resetScale)
        {
            _transform.localScale = _scale;
        }
        if (_resetActive)
        {
            _gameObject.SetActive(_active);
        }

        //Depending on an objects coponents reset appropriate values.
        if (_rb != null)
        {
            _rb.isKinematic     = _isKin;
            _rb.velocity        = Vector3.zero;
            _rb.angularVelocity = Vector3.zero;
        }

        if (_do != null)
        {
            _do.objectHealth = _health;
            _do.isOnFire     = false;
            _do.ResetFire();
            _do.SetHasExploded(false);
        }

        if (_ren != null)
        {
            _ren.material.color = _color;
        }

        if (_playerPhysics != null)
        {
            _playerPhysics.collisions = 0;
            _playerPhysics.ResetAimBalls();
        }

        if (_fireBreathing != null)
        {
            _fireBreathing.flameTime = 1.5f;
        }

        //reset pick-ups and cancael any onvokes
        GameDataModel.SetPickUpVal(GameDataModel.pickupTypes.Fire, 0);
        GameDataModel.Attempts = 3;

        _GameManager.Single().CancelInvoke("EndTurn");
        _GameManager.Single().CancelInvoke("EndInvoker");
        _GameManager.Single().CancelInvoke("CheckForEnd");
    }