コード例 #1
0
 // Use this for initialization
 void Awake()
 {
     if(_instance == null)
     {
         _instance = this;
         pool = new PoolingSystem<AudioPlayer>(audioObjectPrefab, poolSize);
     }
 }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     // Initialise the spheres' pool
     spheres = new PoolingSystem<GameObject>(spherePrefab, 10);
     // Initialise the cubes' pool
     cubes = new PoolingSystem<GameObject>(cubePrefab, 10);
     // Initialise the capsules' pool
     capsules = new PoolingSystem<Rigidbody>(capsulePrefab, 10);
 }
コード例 #3
0
    void Start()
    {
        poolingSystem = PoolingSystem.Instance;

        leftGunT = leftGun.transform;
        rightGunT = rightGun.transform;

        fireEffectL =  poolingSystem.InstantiateAPS("ShootEffect", leftGunT.position, leftGunT.rotation, leftGun);
        fireEffectR =  poolingSystem.InstantiateAPS("ShootEffect", rightGunT.position, rightGunT.rotation, rightGun);

        shootSoundL =  poolingSystem.InstantiateAPS("ShootSound", leftGunT.position, leftGunT.rotation, Camera.main.camera.gameObject);
        shootSoundR =  poolingSystem.InstantiateAPS("ShootSound", rightGunT.position, rightGunT.rotation, Camera.main.camera.gameObject);
    }
コード例 #4
0
ファイル: Rope2D.cs プロジェクト: JasonSlingsCode/CNR
	private PoolingSystem ropePool;				//used for object pooing


	public void Initialize(GameObject chainObject, int count)
	{
		//if pooled objects holder isn't created, create it
		if(!availableChainsHolder)
		{
			availableChainsHolder = GameObject.Find ("Available Chains Holder");

			if(!availableChainsHolder)
				availableChainsHolder = new GameObject("Available Chains Holder");
		}

		//create pooled objects
		ropePool = new PoolingSystem(chainObject, count, "availableChain", availableChainsHolder.transform);
	}
コード例 #5
0
ファイル: PoolingSystem.cs プロジェクト: miskara/Projects
 public static void PlaySound(this GameObject soundSource)
 {
     PoolingSystem.PlaySound(soundSource);
 }
コード例 #6
0
ファイル: PoolingSystem.cs プロジェクト: miskara/Projects
 public static void PlayEffect(this GameObject particleEffect, int particlesAmount)
 {
     PoolingSystem.PlayEffect(particleEffect, particlesAmount);
 }
コード例 #7
0
ファイル: PoolingSystem.cs プロジェクト: miskara/Projects
 public static void DestroyAPS(this GameObject myobject)
 {
     PoolingSystem.DestroyAPS(myobject);
 }
コード例 #8
0
 void Awake()
 {
     poolingSystem        = GetComponent <PoolingSystem>();
     difficultyController = GetComponent <DifficultyController>();
 }
コード例 #9
0
 public void rmFirstFleak()
 {
     PoolingSystem.DestroyAPS(clone);
     launchpad.renderer.material.SetColor("_Color", Color.Lerp(orig, Color.black, 0.5f));
 }
コード例 #10
0
 public void finishSplosion()
 {
     PoolingSystem.DestroyAPS(this.gameObject);
 }
コード例 #11
0
    void Update()
    {
        /*#if UNITY_EDITOR
         * if(Input.GetKey(KeyCode.DownArrow) && Input.GetKeyDown(KeyCode.LeftControl)){
         *      if(transform.localScale == new Vector3(1,1,1)){ // Facing Right
         *              spawnPoint = new Vector3(this.transform.position.x+1f, this.transform.position.y-1f, 0);
         *              checkPhysics2DPoint(spawnPoint);
         *      }else{
         *              spawnPoint = new Vector3(this.transform.position.x-1f, this.transform.position.y-1f, 0);//Check Spawn Point Bottom-Left
         *              checkPhysics2DPoint(spawnPoint);
         *      }
         * }else if(Input.GetKeyDown(KeyCode.LeftControl)){
         *      if(transform.localScale == new Vector3(1,1,1)){ // Facing Right
         *              spawnPoint = new Vector3(this.transform.position.x+1f, this.transform.position.y, 0);
         *              checkPhysics2DPoint(spawnPoint);
         *      }else{
         *              spawnPoint = new Vector3(this.transform.position.x-1f, this.transform.position.y, 0);
         *              checkPhysics2DPoint(spawnPoint);
         *      }
         * }
         *
         * if(Input.GetKeyDown(KeyCode.LeftAlt)){
         *      //Instantiate(fireBall, new Vector3(this.transform.position.x+.5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
         *      if(fireBallInventory > 0){ //Fireballs in Inventory
         *              if(transform.localScale == new Vector3(1,1,1)){ // Facing Right
         *                      pS.InstantiateAPS("Fireball", new Vector3(this.transform.position.x+.5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
         *                      //Instantiate(fireBall, new Vector3(this.transform.position.x+.5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
         *              }else{
         *                      pS.InstantiateAPS("Fireball", new Vector3(this.transform.position.x-.5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
         *                      //Instantiate(fireBall, new Vector3(this.transform.position.x-.5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
         *              }
         *              //fireBallInventory--;
         *      }
         * }
         #endif*/

        if (pS == null)
        {
            pS = PoolingSystem.Instance;
        }

        //if((CnInputManager.GetAxis("Vertical") == -1) && CnInputManager.GetButtonDown("Fire2")){
        //if((CnInputManager.GetAxis("Vertical") == -1)){

        if (CnInputManager.GetButtonDown("DPadDown"))
        {
            if (transform.localScale == new Vector3(1, 1, 1))           // Facing Right
            {
                spawnPoint = new Vector3(this.transform.position.x + 1f, this.transform.position.y - 1f, 0);
                checkPhysics2DPoint(spawnPoint);
            }
            else
            {
                spawnPoint = new Vector3(this.transform.position.x - 1f, this.transform.position.y - 1f, 0);            //Check Spawn Point Bottom-Left
                checkPhysics2DPoint(spawnPoint);
            }
            animator.Play("PlayerDuck");
        }

        if (CnInputManager.GetButtonDown("BoxButton"))
        {
            if (transform.localScale == new Vector3(1, 1, 1))           // Facing Right
            {
                spawnPoint = new Vector3(this.transform.position.x + 1f, this.transform.position.y, 0);
                checkPhysics2DPoint(spawnPoint);
            }
            else
            {
                spawnPoint = new Vector3(this.transform.position.x - 1f, this.transform.position.y, 0);
                checkPhysics2DPoint(spawnPoint);
            };
        }

        if (CnInputManager.GetButtonDown("FireballButton"))
        {
            if (fireBallInventory > 0)                            //Fireballs in Inventory
            {
                if (transform.localScale == new Vector3(1, 1, 1)) // Facing Right
                {
                    pS.InstantiateAPS("Fireball", new Vector3(this.transform.position.x + .5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
                    //Instantiate(fireBall, new Vector3(this.transform.position.x+.5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
                }
                else
                {
                    pS.InstantiateAPS("Fireball", new Vector3(this.transform.position.x - .5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
                    //Instantiate(fireBall, new Vector3(this.transform.position.x-.5f, this.transform.position.y, this.transform.position.z), Quaternion.identity);
                }
                //fireBallInventory--;
                animator.Play("PlayerFire");
            }
        }

        if (fireBallInventory == 0)
        {
            if (fireballButtonImage != null)
            {
                if (fireballButtonImage.sprite != greyFireball)
                {
                    fireballButtonImage.sprite = greyFireball;
                }
            }
            else
            {
                Debug.Log("PlayerController: FireballButtonImage is null. 1st Check");
            }
        }
        else
        {
            if (fireballButtonImage != null)
            {
                if (fireballButtonImage.sprite != regularFireball)
                {
                    fireballButtonImage.sprite = regularFireball;
                }
            }
            else
            {
                if (Application.loadedLevelName == "TutorialOne")
                {
                    //No FireBall Button in that Level
                }
                else if (Application.loadedLevelName == "TutorialTwo")
                {
                    //No FireBall Button in that Level
                }
                else if (Application.loadedLevelName == "TutorialThree")
                {
                    //No FireBall Button in that Level
                }
                else
                {
                    Debug.Log("PlayerController: FireballButtonImage is null. 2nd Check");
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            fireBallInventory++;
        }



        if (Input.GetKeyDown(KeyCode.K))
        {
            playerGetsHurt();
            //Pause Game
            //Reset Player
            //Reset Each Monster (MonsterResetterScript - Searches Once at beginning of level and adds all monsters into array)
            //Find All Slimes, All SpikeBalls, All WingMan
            //Reset Each Box to How it is Supposed to be.
            //UnPause Game
        }
    }
コード例 #12
0
 void Awake()
 {
     pool = GetComponent <PoolingSystem>();
 }
コード例 #13
0
 void Awake()
 {
     Instance = this;
 }
コード例 #14
0
 public void Construct(IMessageBus messageBus, PoolingSystem poolSystem)
 {
     _messageBus = messageBus;
     _poolSystem = poolSystem;
 }
コード例 #15
0
 private void Despawn()
 {
     PoolingSystem.Despawn(explosions[explosionToDestroy]);
     explosionToDestroy++;
 }
コード例 #16
0
ファイル: GiantbugFrtSpawns.cs プロジェクト: miskara/Projects
 new public void removeFruit(GameObject go)
 {
     fruits.Remove(go);
     PoolingSystem.DestroyAPS(go);
 }
コード例 #17
0
 public void InjectDependencies(List <MovingPlatform> movingPlatformsList)
 {
     _poolPlatforms = new PoolingSystem <MovingPlatform> (movingPlatformsList);
 }
コード例 #18
0
 void Awake()
 {
     Instance = this;
 }
コード例 #19
0
    /*void Start () {
     *      pS = PoolingSystem.Instance;
     *      body = this.GetComponent<Rigidbody2D>();
     *      player = GameObject.Find("Player"); //Reference to Player Game Object
     *      primaryController = player.GetComponent<PrimaryController>(); // Reference to PlayerController Script
     *      ZombieSpawner = GameObject.Find("ZombieSpawner"); //Reference to Player Game Object
     *      playerControllerScript = player.GetComponent<PlayerController>(); // Reference to PlayerController Script
     *      //spawnerScript = ZombieSpawner.GetComponent<Spawner> ();
     *      spawnAI = this.GetComponent<SpawnAI>();
     *      circleCollider = GetComponent<CircleCollider2D>();
     *      spriterenderer = this.GetComponent<SpriteRenderer>();
     *
     *
     *      int zombieType = (int)Random.Range(0f,3f);
     *
     *      if (zombieType == 0) {//Regular Zombie
     *              movementSpeed = 1f + (spawnerScript.getCurrentRound () / 10f);
     *              if(movementSpeed > 1.5f){
     *                      movementSpeed = 1.5f;
     *              }
     *              maxHealth = 100 + (spawnerScript.getCurrentRound () * 10);
     *              this.gameObject.name = "Zombie";
     *              //Set Animator To Regular
     *      } else if (zombieType == 1) {
     *              movementSpeed = 1f + (spawnerScript.getCurrentRound () / 2f);
     *              if(movementSpeed > 1.7f){
     *                      movementSpeed = 1.7f;
     *              }
     *              maxHealth = 75;
     *              spriterenderer.sprite = fastZombie;
     *              this.gameObject.name = "FastZombie";
     *              //Set Animator to Fast
     *      } else if (zombieType == 2){
     *              movementSpeed = 1f + (spawnerScript.getCurrentRound () / 10f)/2f;
     *              if(movementSpeed > 1.4f){
     *                      movementSpeed = 1.4f;
     *              }
     *              maxHealth = 100 + (spawnerScript.getCurrentRound () * 10)*2;
     *              spriterenderer.sprite = fatZombie;
     *              this.gameObject.name = "FatZombie";
     *              //animator.SetInteger("Type",2);//Set Animator to Fat
     *      }
     *      currentHealth = maxHealth;
     * }*/

    void OnEnable()
    {
        pS                     = PoolingSystem.Instance;
        player                 = GameObject.Find("Player");                 //Reference to Player Game Object
        primaryController      = player.GetComponent <PrimaryController>(); // Reference to PlayerController Script
        ZombieSpawner          = GameObject.Find("ZombieSpawner");          //Reference to Player Game Object
        zombieSpawnerScript    = ZombieSpawner.GetComponent <ZombieSpawner>();
        playerControllerScript = player.GetComponent <PlayerController>();  // Reference to PlayerController Script
        spriterenderer         = this.GetComponent <SpriteRenderer>();

        dead = true;

        int zombieType = (int)Random.Range(0f, 3f);

        if (zombieType == 0)          //Regular Zombie
        {
            movementSpeed = 1f + (zombieSpawnerScript.getCurrentRound() / 10f);
            if (movementSpeed > 1.5f)
            {
                movementSpeed = 1.5f;
            }
            maxHealth            = 100 + (zombieSpawnerScript.getCurrentRound() * 12);
            this.gameObject.name = "Zombie";
            //Set Animator To Regular
        }
        else if (zombieType == 1)
        {
            movementSpeed = 1f + (zombieSpawnerScript.getCurrentRound() / 2f);
            if (movementSpeed > 1.7f)
            {
                movementSpeed = 1.7f;
            }
            maxHealth = 75 + (zombieSpawnerScript.getCurrentRound() * 10);
            //spriterenderer.sprite = fastZombie;
            this.gameObject.name = "FastZombie";
            //Set Animator to Fast
        }
        else if (zombieType == 2)
        {
            movementSpeed = 1f + (zombieSpawnerScript.getCurrentRound() / 10f) / 2f;
            if (movementSpeed > 1.4f)
            {
                movementSpeed = 1.4f;
            }
            maxHealth = 100 + (zombieSpawnerScript.getCurrentRound() * 12) * 2;
            //spriterenderer.sprite = fatZombie;
            this.gameObject.name = "FatZombie";
            //animator.SetInteger("Type",2);//Set Animator to Fat
        }

        int zombieSprite = (int)Random.Range(0f, 8f);        // 0-7 - inclusive

        if (zombieSprite == 1)
        {
            spriterenderer.sprite = zombieOne;
        }
        else if (zombieSprite == 2)
        {
            spriterenderer.sprite = zombieTwo;
        }
        else if (zombieSprite == 3)
        {
            spriterenderer.sprite = zombieThree;
        }
        else if (zombieSprite == 4)
        {
            spriterenderer.sprite = zombieFour;
        }
        else if (zombieSprite == 5)
        {
            spriterenderer.sprite = zombieFive;
        }
        else if (zombieSprite == 6)
        {
            spriterenderer.sprite = zombieSix;
        }
        else if (zombieSprite == 7)
        {
            spriterenderer.sprite = zombieSeven;
        }
        else
        {
            spriterenderer.sprite = zombieZero;
        }

        currentHealth = maxHealth;
    }