Ejemplo n.º 1
0
    void OpenDoor()
    {
        isOpen     = true;
        isHalfOpen = false;
        _worldEntity.CollidingType = EntityCollidingType.Empty;
        //_worldEntity.DestroyVisual();

        _worldEntity.ChangeVisual(GetSpriteByID());
    }
Ejemplo n.º 2
0
    private void Shoot()
    {
        GameObject bulletObject = (GameObject)Instantiate(_bullet);
        var        bullet       = bulletObject.GetComponent <Bullet>();
        var        bulletEntity = bulletObject.GetComponent <WorldEntity>();

        bulletEntity.instantMove = true;
        bulletEntity.Location    = _worldEntity.Location;
        var bulletTrigger = bulletObject.GetComponent <WorldEntity>();

        bulletTrigger.Location = _worldEntity.Location;
        bullet.direction       = shootingDirection;
        _needShoot             = false;
        bullet.sourceShooter   = gameObject.GetComponent <WorldEntity>();


        StartCoroutine(WaitBeforeShooting(_beforeShootingDuration));

        _worldEntity.ChangeVisual(GetSpriteByID());
        StartCoroutine(WaitForShooting(_shootingDuration));
    }
Ejemplo n.º 3
0
    private void TryMove(Direction tryDirection)
    {
        switch (WorldManager.g.CanMove(_worldEntity.Location, tryDirection, _worldEntity))
        {
        case MoveResult.Move:
            isStuck = false;
            MoveOneStep(tryDirection);
            //AudioSource.PlayClipAtPoint(_audioMove, _worldEntity.Location.ToVector2(), LevelCode.audioVolume);

            //print("move");
            break;

        case MoveResult.Stuck:
            _needMove = false;
            print("error! pusher stuck!");
            StartCoroutine(PushingContract(_pushingContractDuration));
            StartCoroutine(PushingStretch(_pushingStrechDuration));
            isStuck = true;
            break;

        case MoveResult.Push:
            isStuck = false;
            MoveOneStep(tryDirection);
            AudioSource.PlayClipAtPoint(_audioPush, CameraControl.cameraLoc, LevelCode.audioVolume);
            _pushingState = PushingState.Contract;
            _worldEntity.ChangeVisual(GetSpriteByID());
            StartCoroutine(PushingContract(_pushingContractDuration));
            StartCoroutine(PushingStretch(_pushingStrechDuration));

            //print("push");
            break;

        default:
            break;
        }
    }