Esempio n. 1
0
 private void Awake()
 {
     _rb           = GetComponent <Rigidbody>();
     _bulletPool   = GetComponentInChildren <BulletsPool>();
     _weaponSystem = GetComponentInChildren <WeaponSystem>();
     _player       = GameObject.FindWithTag("Player").transform;
 }
Esempio n. 2
0
    public PlayerController(PlayerModel playerModel, PlayerView playerView, Transform spawnPoint, BulletsPool bulletsPool, Action gameOver)
    {
        _playerModel = playerModel;
        _playerView  = playerView.Init(spawnPoint);

        _bulletsPool = bulletsPool;

        _playerView.Repaint(gameOver);
    }
Esempio n. 3
0
 void Start()
 {
     bulletsPool       = GameObject.Find("BulletPool").GetComponent <BulletsPool> ();
     onDragAimJoystick = GameObject.Find("AimBackgroundJoystick").GetComponent <VirtualJoystick> ();
     _as = GetComponent <AudioSource> ();
     if (GameObject.Find("FireButton") != null)
     {
         fireButton = GameObject.Find("FireButton").GetComponent <VirtualButton> ();
     }
     InvokeRepeating("CreateBullet", 0, fireRate);
 }
    private bool _isBulletInPool; // HotFix

    private void Awake()
    {
        // Binds from
        _rb          = GetComponent <Rigidbody>();
        _bulletspool = GetComponentInParent <BulletsPool>();
        //
        Damage = BulletSettings.Damage;
        _force = BulletSettings.Force;
        //
        _isBulletInPool = true;
    }
Esempio n. 5
0
 void Awake()
 {
     if (bulletsPoolInstance == null)
     {
         bulletsPoolInstance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 6
0
    public static BulletsPool bulletsPoolInstance;      //子弹池实例
    void Awake()
    {
        //初始化武器类型
        nowType             = GunEnum.normal;
        boomObj.bullet      = boom;
        setObj.bullet       = sett;
        roketObj.bullet     = roket;
        bulletsPoolInstance = this;                     //把本对象作为实例

        //初始化子弹
        InitBullet(boomObj);
        InitBullet(setObj);
        InitBullet(roketObj);
    }
Esempio n. 7
0
    }                                                 //closed singleton

    private void Awake()
    {
        if (Instance != null)
        {
            Destroy(this);
        }
        else
        {
            Instance = this;
        }

        foreach (Transform child in transform)
        {
            bullets.Add(child.gameObject);
        }
    }
Esempio n. 8
0
 private void Awake()
 {
     playerInstance = this;
     bulletPool_Ins = BulletsPool.bulletsPoolInstance;
     selfHpbar      = Instantiate(Resources.Load <GameObject>("Prefab/HpCanvas"), this.transform.position + hpHeight * Vector3.up, Quaternion.identity) as GameObject;
     //初始化子弹
     gunType       = GunEnum.normal;
     gunnameText   = selfHpbar.transform.Find("Text").GetComponent <Text>();
     shotTransform = gameObject.transform.Find("FirePoint").transform;
     //初始化音效
     attackAudio         = Resources.Load <AudioClip>("Sound/gunshot");
     roketAudio          = Resources.Load <AudioClip>("Sound/roket");
     deathAudio          = Resources.Load <AudioClip>("Sound/game_over");
     hitAudio            = Resources.Load <AudioClip>("Sound/Hit");
     playerMesh          = transform.Find("Mesh").GetComponent <SkinnedMeshRenderer>();
     playerMesh.material = Resources.Load <Material>("Materials/Player/Player" + PlayerPrefs.GetInt("PlayerMatID", 0).ToString());
     //初始化特效
     //skillEffect = transform.Find("LinRenderer").GetComponent<LineRenderer>();
 }
Esempio n. 9
0
    void Awake()
    {
        //Obtemos el índice del último diseño equipado
        currentArtStye = PlayerPrefs.GetInt("CurrentArtStyle");
        //Instanciamos al player según el diseño obtenido
        Instantiate(artStyles [currentArtStye].player, Vector2.zero, Quaternion.identity);
        enemyPool  = GameObject.Find("EnemyPool").GetComponent <EnemyPool>();
        bulletPool = GameObject.Find("BulletPool").GetComponent <BulletsPool>();

        //Por cada tipo de enemigo en el diseño obtenido se les agrega al pool de enemigos
        for (int i = 0; i < artStyles[currentArtStye].enemies.Length; i++)
        {
            GameObject newEnemyType = artStyles [currentArtStye].enemies [i];
            enemyPool.enemiesTypes [i] = newEnemyType;
        }
        //Agregamos la bala correspondiente
        bulletPool.bulletPrefab = artStyles[currentArtStye].bullet;

        if (artStyles [currentArtStye].background != null)
        {
            //Asignamos el respectivo background sólo si el artystyle tiene uno
            background.sprite = artStyles [currentArtStye].background;
        }
        else
        {
            //En caso contrario desactivamos el fondo
            background.gameObject.SetActive(false);
        }
        //Cambiamos de color al background(Por ahora el de la cámara)

        /*Color newColor = new Color(1/artStyles[currentArtStye].backgroundColor.x,
         *      1/artStyles[currentArtStye].backgroundColor.y,
         *      1/artStyles[currentArtStye].backgroundColor.z);
         * Camera.main.backgroundColor = newColor;*/
        Instantiate(artStyles [currentArtStye].virtualController);
    }
Esempio n. 10
0
 private void Awake()
 {
     //单例模式
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
Esempio n. 11
0
    private int currentIndex = 0;                       //当前指向链表位置索引

    void Awake()
    {
        bulletsPoolInstance = this;                     //把本对象作为实例。
    }
Esempio n. 12
0
    private int currentIndex = 0;                       //当前指向链表位置索引

    void Awake()
    {
        Instance = this;                 //把本对象作为实例。
    }
Esempio n. 13
0
 void Awake()
 {
     pool = this;
 }
Esempio n. 14
0
 void Awake()
 {
     Instance = this;
     LoadBullets();
 }