// Start is called before the first frame update
    void Start()
    {
        /*halfScreenWidth = Screen.width / 2;
         * halfScreenHeight = Screen.height / 2;
         * centerScreen = Quaternion.Euler(0f, 0f, 0f); */
        rb = GetComponent <Rigidbody2D>();
        ss = this.gameObject.GetComponent <ShipShoot>();
        GetHealth();

        invincibilityBubble.SetActive(false);
    }
Пример #2
0
    }    //End CreateEnemies

    void CreateBullets()
    {
        GameObject bullet = GameObject.CreatePrimitive(PrimitiveType.Cube);

        bullet.name = "Bullet";
        float _xpos = ship.transform.position.x;                // gives same position of ship
        float _ypos = ship.transform.position.y;                //sets bullet at tip of ship

        bullet.AddComponent <ShipShoot> ();
        ShipShoot sbullet = bullet.GetComponent <ShipShoot> ();

        sbullet.SetBullet(_xpos, _ypos, 0.2f, 0.3f, 0.4f); //float _x, float _y, float _xScale, float _yScale, float _speed
    }                                                      //End CreateBullets
Пример #3
0
    private void InitializePlayer()
    {
        var playerShipGO    = Instantiate(playerData.PlayerShipTransform);
        var playerTransform = playerShipGO.transform;
        var shipMarkUp      = playerShipGO.GetComponent <ShipMarkUp>();

        var moveTransform = new AccelerationMove(playerTransform, playerData.MoveData.InitialSpeed, playerData.MoveData.Acceleration);
        var rotation      = new RotationShip(playerTransform);
        var shipShoot     = new ShipShoot(shipMarkUp.Barrels, playerData.ShootData.Bullet, playerData.ShootData.ShootForce);

        var playerHP = new Stat(new MinMaxCurrent(0, playerData.PlayerHp, playerData.PlayerHp));
        var ship     = new Ship(moveTransform, rotation, shipShoot, playerTransform, transformRegistry, playerHP, shipMarkUp);

        player = new Player();
        player.Initialize(playerLoopProcessor as PlayerLoopProcessor, ship, Camera.main);
    }
 // Use this for initialization
 void Start()
 {
     bullet = gameObject.GetComponent<ShipShoot> ();
 }
 // Use this for initialization
 void Start()
 {
     rend = GetComponent<Renderer> ();
     bullet = gameObject.GetComponent<ShipShoot> ();
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     rend   = GetComponent <Renderer> ();
     bullet = gameObject.GetComponent <ShipShoot> ();
 }
 // Use this for initialization
 void Start()
 {
     bullet = gameObject.GetComponent <ShipShoot> ();
 }