Esempio n. 1
0
        public void Show(int damageAmount, Vector2 _position, RexPool _parentSpawnPool)
        {
            textMesh.text      = damageAmount.ToString();
            transform.position = _position;
            parentSpawnPool    = _parentSpawnPool;

            StartCoroutine("ShowCoroutine");
        }
Esempio n. 2
0
        public void Fire(Vector2 _startingPosition, Direction.Horizontal _horizontal, Direction.Vertical _vertical, RexActor _spawningActor, RexPool _parentSpawnPool = null)
        {
            if (!willDestroyWhenSceneChanges)
            {
                DontDestroyOnLoad(gameObject);
            }

            isFiring         = true;
            isBeingReflected = false;
            movementSpeed    = originalMovementSpeed;
            spawningActor    = _spawningActor;

            if (sounds.fireSound)
            {
                GetComponent <AudioSource>().PlayOneShot(sounds.fireSound);
            }

            if (_parentSpawnPool != null)
            {
                parentSpawnPool = _parentSpawnPool;
            }

            SetPosition(_startingPosition);
            SetHorizontalDirection(_horizontal);
            SetVerticalDirection((Direction.Vertical)((int)startingVerticalDirection * (int)_vertical * PhysicsManager.Instance.gravityScale));

            firingDirection = _horizontal;

            slots.physicsObject.properties.acceleration = Vector2.zero;

            float startingXSpeed = (acceleration == 0.0f) ? movementSpeed.x * (int)direction.horizontal : 0.0f;

            slots.physicsObject.SetVelocityX(startingXSpeed);
            slots.physicsObject.SetAccelerationCapX(movementSpeed.x * (int)direction.horizontal);

            float startingYSpeed = (acceleration == 0.0f) ? movementSpeed.y * (int)direction.vertical : 0.0f;

            slots.physicsObject.SetVelocityY(startingYSpeed);
            slots.physicsObject.SetAccelerationCapY(movementSpeed.y * (int)direction.vertical);
        }
Esempio n. 3
0
 protected void OnDestroy()
 {
     splashSound     = null;
     enterSplashPool = null;
     exitSplashPool  = null;
 }