Ejemplo n.º 1
0
 protected override void OnUpdate()
 {
     if (battleContext.enemyMonsters.All(m => battleContext.monsterBattleTurnDatas[m].actionDone))
     {
         onEnemyTurnComplete?.Raise(this, null);
     }
 }
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.collider.CompareTag(GameTags.PlayerTag))
     {
         collisionTime = Time.time;
         updateLevelProgress.Raise();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Place PG in the real world environement. Called everytime a finger touches the screen. Referenced in the inspector on listener on OnFingerTouchedEvent
 /// </summary>
 public void PlacePlayGround()
 {
     if (!isPlayGroundPlaced && isPlaneDetected)                                                                                               //if a plane is detected and the playground isn't placed
     {
         InstantiatedPlayGround = Instantiate(PlayGroundPrefab, PlacementIndicator.transform.position, PlacementIndicator.transform.rotation); //instantiate PG
         isPlayGroundPlaced     = true;
         PGPlacedEvent.Raise();
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Place ball in the real world environement. Called everytime a finger touches the screen. Referenced in the inspector on listener on OnFingerTouchedEvent
 /// </summary>
 public void PlaceBall()
 {
     if (!isBallPlaced && isPlayGroundPlaced)                                                                                      //if the playground is placed and there is no ball placed
     {
         InstantiatedBall = Instantiate(ballPrefab, PlacementIndicator.transform.position, PlacementIndicator.transform.rotation); //instantiate ball
         InstantiatedBall.transform.LookAt(InstantiatedPlayGround.transform.GetChild(0));                                          //set default rotation of the ball (looking at the goal)
         isBallPlaced = true;
         BallBlacedEvent.Raise();
     }
 }
Ejemplo n.º 5
0
    IEnumerator AttackBoss()
    {
        while (bossHealth.value > .5f)
        {
            yield return(new WaitForSeconds(.1f));

            bossHealth.value -= .01f;
            HealthChanged.Raise();
        }
    }
Ejemplo n.º 6
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Ball"))
     {
         //UserNames_SoList.userScores[UsersControl.currentUser] += 10;  //increment score when ball hits the score collider
         //UsersControl.currentScore = UserNames_SoList.userScores[UsersControl.currentUser]; //save this user's score after the increment
         Destroy(other.gameObject, 0.5f); //destroy ball
         OnGoalScored.Raise();            //fire OnGoalScored event to update the score text
     }
 }
Ejemplo n.º 7
0
 protected virtual void RaisEvents()
 {
     if (this.valChanged != null)
     {
         valChanged(this, EventArgs.Empty);
     }
     if (OnChanged != null)
     {
         OnChanged.Raise();
     }
 }
 void Update()
 {
     if (Input.GetMouseButtonDown(0) && Player.isGrounded)
     {
         OnPlayerTab.Raise();
     }
     if (Input.GetKeyDown(KeyCode.Space))
     {
         OnCollectGems.Raise();
     }
 }
Ejemplo n.º 9
0
        public async System.Threading.Tasks.Task Load()
        {
            battleContext.Init();
            var loadEnvTask = GameEntry.Environment.Load(EnvironmentType.Environment_1);

            battleContext.player = GameEntry.Creatures.Load(new CreatureInfo()
            {
                type = CreaturesType.Player
            }) as PlayerLogic;
            battleContext.playerMonsters.Add(GameEntry.Creatures.Load(new CreatureInfo()
            {
                type = CreaturesType.Monsters, entryId = 1, party = CreaturesParty.Player
            }) as MonsterLogic);
            battleContext.playerMonsters.Add(GameEntry.Creatures.Load(new CreatureInfo()
            {
                type = CreaturesType.Monsters, entryId = 2, party = CreaturesParty.Player
            }) as MonsterLogic);
            battleContext.enemyMonsters.Add(GameEntry.Creatures.Load(new CreatureInfo()
            {
                type = CreaturesType.Monsters, entryId = 3, party = CreaturesParty.Enemy
            }) as MonsterLogic);

            battleContext.environment = await loadEnvTask;
            var contexts = GameEntry.Environment.GetEnvironmentContext(EnvironmentType.Environment_1);
            var context  = contexts[0];

            battleContext.player.SetPoint(context.GetPlayerPoint(0));
            for (int i = 0; i < battleContext.playerMonsters.Count; i++)
            {
                battleContext.playerMonsters[i].SetPoint(context.GetPlayerMonsterPoint(i));
                battleContext.monsterBattleTurnDatas.Add(battleContext.playerMonsters[i], new BattleContext.BattleTurnData());
            }
            for (int i = 0; i < battleContext.enemyMonsters.Count; i++)
            {
                battleContext.enemyMonsters[i].SetPoint(context.GetEnemyPoint(i));
                battleContext.monsterBattleTurnDatas.Add(battleContext.enemyMonsters[i], new BattleContext.BattleTurnData());
            }

            battleContext.player.SetMonsters(battleContext.playerMonsters);
            await battleContext.player.Show();

            for (int i = 0; i < battleContext.playerMonsters.Count; i++)
            {
                await battleContext.playerMonsters[i].Show();
            }
            for (int i = 0; i < battleContext.enemyMonsters.Count; i++)
            {
                await battleContext.enemyMonsters[i].Show();
            }

            InitBattleCompleteEvent?.Raise(this, battleContext);
        }
Ejemplo n.º 10
0
 protected override void OnExecute()
 {
     battleContext = GameEntry.Context.Battle;
     GameEntry.Event.OnViewPointerClick.AddListener(OnViewPointerClick);
     GameEntry.Event.OnViewPointerEnter.AddListener(OnViewPointerEnter);
     GameEntry.Event.OnViewPointerExit.AddListener(OnViewPointerExit);
     battleContext.alreadyPlayerMonsterHovered = false;
     battleContext.playerMonsters.ForEach(m => m.Selectable = !battleContext.monsterBattleTurnDatas[m].actionDone);
     if (battleContext.playerMonsters.All(m => battleContext.monsterBattleTurnDatas[m].actionDone))
     {
         onAllPlayerMonstersActionDone?.Raise(this, null);
     }
 }
 void Start()
 {
     levelStarted.Raise();
 }
Ejemplo n.º 12
0
    void Update()
    {
        if (canInput) //This is false only when the PG scale and rotation UI is shown to avoid placing the ball by mistake
        {
            fingerTouched  = Input.GetMouseButtonDown(0);
            fingerReleased = Input.GetMouseButtonUp(0);


            if (fingerReleased)
            {
                FingerReleasedEvent.Raise();
            }

            if (fingerTouched)
            {
                FingerTouhcedEvent.Raise();
            }
        }

        #region old method, kept for the record
        //if (!isPlayGroundPlaced)
        //{

        //    if (fingerTouched)
        //    {
        //        PlacePlayGround();

        //        isPlayGroundPlaced = true;
        //    }
        //}

        //else if (!isBallPlaced)
        //{

        //    if (!fingerTouched)
        //    {
        //        ShowHints();
        //    }
        //    else
        //    {
        //        HideHints();
        //        PlaceBall();

        //        isBallPlaced = true;
        //    }
        //}

        //if (PlayGroundTransformSet)
        //{
        //    if (fingerReleased)
        //    {
        //        if (isBallPlaced)
        //        {
        //            Invoke("SetCanShoot", 0.3f);
        //        }
        //        else
        //        {
        //            canShoot = false;
        //        }
        //    }

        //    if (fingerReleased && canShoot == true)
        //    {
        //        ShootBall();
        //    }
        //}
        #endregion
    }