Esempio n. 1
0
 public virtual void PlaceFightFlag(Vector3 location)
 {
     fightFlag.SetActive(true);
     fightFlagTran.position = location;
     activeFightFlag        = true;
     UnityEventManager.TriggerEvent("PlaceFightFlag", unitID);
 }
Esempio n. 2
0
 public virtual void RecallFightFlag()
 {
     fightFlagTran.position = transform.position;
     fightFlag.SetActive(false);
     activeFightFlag = false;
     UnityEventManager.TriggerEvent("PlaceFightFlag", unitID);
 }
Esempio n. 3
0
    IEnumerator GenerateWave()
    {
        do
        {
            killed  = 0;
            spawned = 0;
            Vector2 point = (Vector2)spawnPoints[Random.Range(1, spawnPoints.Length)].position;

            while (killed < waveAmounts[wave])
            {
                for (int b = 0; b < enemies.Length; b++)
                {
                    if (!enemies[b].activeSelf && spawned < waveAmounts[wave])
                    {
                        enemies[b].transform.position = Random.insideUnitCircle + point;
                        enemies[b].SetActive(true);
                        spawned++;
                        //yield return new WaitForSeconds(.4f);
                        //break;
                    }
                }
                yield return(null);
            }
            wave += 1;
            yield return(new WaitForSeconds(5f));

            UnityEventManager.TriggerEvent("NewWave");
        }while(wave < waveAmounts.Length);
        //GameOver();
    }
Esempio n. 4
0
	public void Attach(GameObject newParent, Vector3 point)
	{
		transform.SetParent(newParent.transform);
		transform.localPosition = point;
		bAttached = true;
		RpcAttach(newParent, point);
		UnityEventManager.TriggerEvent("TargetUnavailable",Id);
	}
Esempio n. 5
0
 //[ClientRpc]
 public void SetHealthUI(float h)
 {
     health = h;
     if (isLocalPlayer && this.GetType() == typeof(PlayerMomController))
     {
         UnityEventManager.TriggerEvent("UpdateHealth", (int)health);
     }
 }
Esempio n. 6
0
 public void SetFoodUI(int h)
 {
     foodAmount = h;
     if (isLocalPlayer && this.GetType() == typeof(PlayerMomController))
     {
         UnityEventManager.TriggerEvent("UpdateFood", foodAmount);
     }
 }
Esempio n. 7
0
	public void Destroy()
	{
		transform.position = Vector3.zero;
		Detach();
		UnityEventManager.TriggerEvent("TargetUnavailable",Id);
		gameObject.SetActive(false);
		RpcDestroy();
	}
Esempio n. 8
0
 void OnEnable()
 {
     DontDestroyOnLoad(this.gameObject);
     levelGen = GetComponent <GenerateLevel>();
     SceneManager.sceneLoaded += OnSceneLoaded;         //this only makes sense if this object persists through scenes
     UnityEventManager.StartListeningInt("MoMDeath", IsGameOver);
     UnityEventManager.StartListening("StartGame", StartNewGame);
 }
Esempio n. 9
0
 void Start()
 {
     //SecondString +=": ";
     text      = GetComponent <Text>();
     text.text = string.Format("{0}: {1}", variableName, variable);
     //GetComponent<Text>().text =  string.Format("{0} {1}  {2} {3}",FirstString, FirstValue, SecondString, SecondValue);
     //UnityEventManager.StartListeningInt("Score", AddPoints);
     UnityEventManager.StartListeningInt(variableName + "Event", AddValue);
 }
Esempio n. 10
0
	// FoodDisplay foodDisplay;
	// HealthDisplay healthDisplay;

	void OnEnable()
	{
		UnityEventManager.StartListeningInt("UpdateFood", SetFood);
		UnityEventManager.StartListeningInt("UpdateHealth", SetHealth);
		UnityEventManager.StartListeningInt("MoMDeath", Notify);
		StartCoroutine(UpdateInfo());
//		healthText.text =  "Health: " + 0;
//		scoreText.text =  "Food: " + 0;
	}
Esempio n. 11
0
 public void Die()
 {
     //GameObject boom = Instantiate(explosion,transform.position,Quaternion.identity) as GameObject;
     //Destroy(boom,3f);
     this.gameObject.SetActive(false);
     UnityEventManager.TriggerEvent("Score", pointValue);
     SoundManager.instance.PlaySingle(death);
     StopCoroutine(FlashDamage());
     spriteRenderer.color = original;
 }
Esempio n. 12
0
 protected override void Death()
 {
     base.Death();
     Foods.Clear();
     newQueen();
     if (NewGameController.Instance.TeamSize[teamID] == 0)
     {
         UnityEventManager.TriggerEvent("MoMDeath", teamID);            //sends notification to GUI
     }
 }
Esempio n. 13
0
    public void Dead()
    {
        if (treasureDrop != null)
        {
            GameObject.Instantiate(treasureDrop, Location, Quaternion.identity);
        }

        isActive = false;
        UnityEventManager.TriggerEvent("TargetUnavailable", unitID);
    }
Esempio n. 14
0
 void OnEnable()
 {
     Player = GameObject.FindGameObjectWithTag("Player");
     UnityEventManager.StartListeningInt("Score", CountKilled);
     ObjectPool.CreatePool("Bullets", 20, bulletFab);
     ObjectPool.CreatePool("Enemies", enemyNumber, enemyFab);
     enemies = ObjectPool.DrawFromPool(enemyNumber, "Enemies");
     //for different enemy types we could have diferent pools
     spawnPoints = GetComponentsInChildren <Transform>();
 }
Esempio n. 15
0
 protected override void OnEnable()
 {
     spark       = GetComponentInChildren <ParticleSystem>();
     enemies     = new List <Unit_Base>();
     targetEnemy = null;
     mask        = 1 << LayerMask.NameToLayer("Units");
     canAttack   = true;
     base.OnEnable();
     UnityEventManager.StartListeningInt("PlaceFightFlag", UpdateFlagLocation);
 }
Esempio n. 16
0
 protected virtual void Death()
 {
     UnityEventManager.TriggerEvent("TargetUnavailable", unitID);
     bMoving    = false;
     isActive   = false;
     hasChanged = false;
     if (teamID >= 0 && NewGameController.Instance.TeamSize[teamID] > 0)
     {
         NewGameController.Instance.TeamSize[teamID] -= 1;
     }
 }
Esempio n. 17
0
    public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer)
    {
        LobbyPlayer lobby  = lobbyPlayer.GetComponent <LobbyPlayer>();
        Interact    player = gamePlayer.GetComponent <Interact>();

        player.name       = lobby.name;
        player.teamColor  = lobby.playerColor;
        player.teamNumber = playerCount;
        playerCount++;
        UnityEventManager.TriggerEvent("StartGame");
        //GameController.instance.RegisterPlayer(gamePlayer);
    }
Esempio n. 18
0
    protected override void OnEnable()
    {
        base.OnEnable();
        if (GetComponentInChildren <MeshRenderer>().materials.Length > 1)
        {
            TeamColorMat = GetComponentInChildren <MeshRenderer>().materials[1];
        }
        sqrDist = orbit * orbit;
        UnityEventManager.StartListeningInt("TargetUnavailable", TargetLost);
//		childTransform = GetComponent<NetworkTransformChild>();
//		if(childTransform!=null)
//		childTransform.enabled = false;
        //StartCoroutine(Idle());
    }
Esempio n. 19
0
 protected override void OnEnable()
 {
     base.OnEnable();
     anchor         = tran.position;
     TeamColorMat   = GetComponentInChildren <MeshRenderer>().material;
     eaten          = 0;
     bMoving        = false;
     bReturning     = false;
     spark          = GetComponentInChildren <ParticleSystem>();
     enemies        = new List <Unit_Base>();
     enemiesCarried = new GameObject[maxCarry];
     mask           = 1 << LayerMask.NameToLayer("Units");
     canAttack      = false;
     StartCoroutine(AttackCooldown());
     bDay = NewGameController.Instance.IsDaylight;
     UnityEventManager.StartListeningBool("DayTime", DaySwitch);
 }
Esempio n. 20
0
 void Update()
 {
     if (hasGameStarted)
     {
         DayLight.Rotate(DayLight.right, SunSpeed * Time.deltaTime, Space.World);
         NightLight.Rotate(NightLight.right, SunSpeed * Time.deltaTime, Space.World);
         if (!IsDayLight() && bDay)
         {
             bDay = false;
             UnityEventManager.TriggerEvent("DayTime", false);
             DayLight.gameObject.SetActive(false);
         }
         else if (IsDayLight() && !bDay)
         {
             bDay = true;
             UnityEventManager.TriggerEvent("DayTime", true);
             DayLight.gameObject.SetActive(true);
         }
     }
 }
Esempio n. 21
0
 protected virtual void OnTriggerEnter(Collider bam)
 {
     if (bam.CompareTag("Treasure") && canPickupTreasure && !bCarryingTreasure)
     {
         Treasure pickup = bam.GetComponent <Treasure>();           //treasure implements IPickup
         if (pickup.IsAvailable)
         {
             pickup.Pickup(transform);
             bCarryingTreasure = true;
             carriedTreasure   = pickup;
         }
         //bam.gameObject.SetActive(false);
     }
     if (bam.CompareTag("Capture") && carriedTreasure != null)
     {
         UnityEventManager.TriggerEvent("TreasureEvent", carriedTreasure.Value);
         bCarryingTreasure = false;
         carriedTreasure.PutDown();
         carriedTreasure = null;
     }
 }
Esempio n. 22
0
 protected override void Death()
 {
     //base.Death();
     if (myMoM.isActive)
     {
         CedeDrones(myMoM);
     }
     else
     {
         KillDrones();
     }
     myMoM.daughters -= 1;
     Foods.Clear();
     UnityEventManager.TriggerEvent("TargetUnavailable", unitID);
     bMoving    = false;
     isActive   = false;
     hasChanged = false;
     if (teamID >= 0 && NewGameController.Instance.TeamSize[teamID] > 0)
     {
         NewGameController.Instance.TeamSize[teamID] -= 1;
     }
 }
Esempio n. 23
0
 void OnDisable()
 {
     UnityEventManager.StopListening("StartGame", StartGame);
 }
Esempio n. 24
0
 void OnEnable()
 {
     DontDestroyOnLoad(this.gameObject);
     UnityEventManager.StartListening("StartGame", StartGame);
 }
Esempio n. 25
0
 protected override void OnEnable()
 {
     base.OnEnable();
     mask = 1 << LayerMask.NameToLayer("Food");
     UnityEventManager.StartListeningInt("PlaceFarmFlag", UpdateFlagLocation);
 }
Esempio n. 26
0
 void OnDisable()
 {
     UnityEventManager.StopListeningInt("Score", CountKilled);
     ObjectPool.CloseDictionary();
 }
Esempio n. 27
0
	void OnDisable()
	{
		UnityEventManager.StopListeningInt("UpdateFood", SetFood);
		UnityEventManager.StopListeningInt("UpdateHealth", SetHealth);
	}
Esempio n. 28
0
 void Start()
 {
     GetComponent <Text>().text = string.Format("Points: {0}  Waves: {1}", points, waves);
     UnityEventManager.StartListeningInt("Score", AddPoints);
     UnityEventManager.StartListening("NewWave", AddWave);
 }
Esempio n. 29
0
 protected override void OnDisable()
 {
     base.OnDisable();
     UnityEventManager.StopListeningInt("PlaceFarmFlag", UpdateFlagLocation);
 }
Esempio n. 30
0
 void OnDisable()
 {
     UnityEventManager.StopListeningInt("Score", AddPoints);
     UnityEventManager.StopListening("NewWave", AddWave);
 }