コード例 #1
0
ファイル: Ship.cs プロジェクト: alexanderbenfox/SHMUP
    public void Init(bool isAI, HealthBar healthBar)
    {
        _hpBar = healthBar;
        bulletPool.Init(this);

        ChangeWeapon(WeaponType.Blaster);

        sfxController.Init(10, transform);
        _spriteRenderer = this.GetComponent <SpriteRenderer>();

        _controlledByAI = isAI;
        shootDirection  = Vector2.right;
        if (isAI)
        {
            shootDirection = Vector2.left;
        }

        _collider = this.GetComponent <BoxCollider2D>();
        zone.Init();

        type = "Player";

        //spawn thrusters
        float f = (2.5f / 1.91f);
        //float f = Mathf.Sqrt(2);
        var thrusterPosition  = new Vector2((shootDirection.x * -1) * _spriteRenderer.size.x / f, 0);
        var thrustersAnimName = isAI ? "Thrusters2" : "Thrusters";

        sfxController.SpawnPersistentSFXAnimation(thrusterPosition, new Vector2(.95f, .95f), thrustersAnimName, shootDirection == Vector2.left);

        ResetStatus();
    }