// Update is called once per frame
    void Update()
    {
        var moveAmt = Input.GetAxis("Horizontal") * MOVE_SPEED * Time.deltaTime;

        if (moveAmt == 0)
        {
            this.rend.materials[0].mainTexture = stableShip;
        }
        else if (moveAmt > 0)
        {
            this.rend.materials[0].mainTexture = rightShip;
        }
        else
        {
            this.rend.materials[0].mainTexture = leftShip;
        }

        var pos = this.trans.position;

        pos.x += moveAmt;
        this.trans.position = pos;

        if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space))
        {
            var spawnPos = this.trans.position;
            spawnPos.z += 15;

            if (!string.IsNullOrEmpty(customEventName) && LevelSettings.CustomEventExists(customEventName))
            {
                LevelSettings.FireCustomEvent(customEventName, this.trans);
            }
            PoolBoss.SpawnOutsidePool(ProjectilePrefab.transform, spawnPos, ProjectilePrefab.transform.rotation);
        }
    }
Esempio n. 2
0
        private void SpawnPlayer()
        {
            _player = PoolBoss.SpawnOutsidePool(PlayerPrefab, _playerPosition, PlayerPrefab.transform.rotation);

            var spawnPos = _playerPosition + RespawnParticleOffset;

            if (RespawnParticlePrefab != null)
            {
                PoolBoss.SpawnInPool(RespawnParticlePrefab, spawnPos, RespawnParticlePrefab.transform.rotation);
            }
        }