// Start is called before the first frame update
 void Start()
 {
     startedConvo     = false;
     deathHandled     = false;
     convoHandler     = FindObjectOfType <ConvoHandler>();
     cameraController = FindObjectOfType <CameraController>();
     conversation     = GetComponentInChildren <Conversation>();
     //leftMinion = leftMinionNode.GetComponentInChildren<Actor>().gameObject;
     //rightMinion = rightMinionNode.GetComponentInChildren<Actor>().gameObject;
     node = GetComponent <Node>();
     game = FindObjectOfType <Game>();
     //destroyedLeft = false;
     //destroyedRight = false;
     //self = GetComponentInChildren<Actor>().gameObject;
 }
 // Start is called before the first frame update
 void Start()
 {
     convoHandler = FindObjectOfType <ConvoHandler>();
 }
Пример #3
0
 // Update is called once per frame
 void Update()
 {
     if (player != null)
     {
         if (player.IsAtTarget())
         {
             Node node = GetOverlap(player);
             if (node != null && node.risk > 0 && node != actionedNode)
             {
                 actionedNode = node;
             }
             if (node != null)
             {
                 Goal goal = node.gameObject.GetComponent <Goal>();
                 if (goal != null)
                 {
                     reachedGoal = goal;
                 }
                 Pickup pickup = node.pickup;
                 if (pickup != null && !pickup.consumed)
                 {
                     if (pickup.type == Pickup.PickupType.HEALTH)
                     {
                         pickup.Consume();
                         node.UpdateRiskText();
                         explosionHandler.PickupPlant(pickup.gameObject.transform.position + new Vector3(0, 0.4f, 0.4f));
                         playerHealth += pickup.amount;
                     }
                 }
                 GameInfo gameInfo = node.gameObject.GetComponentInChildren <GameInfo>();
                 if (gameInfo != null && !gameInfo.isShown)
                 {
                     ConvoHandler convoHandler = FindObjectOfType <ConvoHandler>();
                     convoHandler.ShowInfo(gameInfo);
                     gameInfo.Consume();
                 }
             }
         }
         if (waypoints.Count > 0)
         {
             if (waypoints.Count > 1)
             {
                 player.targetPos = waypoints[waypoints.Count - 1].transform.position;
             }
             else
             {
                 if (selectedNode != null && selectedNode.risk > 0)
                 {
                     Vector3 direction = Vector3.Normalize(selectedNode.transform.position - selectedPlayer.transform.position);
                     selectedPlayer.targetPos = selectedNode.transform.position - (direction * 1f);
                 }
                 else
                 {
                     player.targetPos = waypoints[waypoints.Count - 1].transform.position;
                 }
             }
             if (player.IsAtTarget())
             {
                 waypoints.Remove(waypoints[waypoints.Count - 1]);
             }
         }
     }
     if (isRolling)
     {
         diceResult = UnityEngine.Random.Range(1, 7);
     }
     else
     {
         diceResult = -100;
     }
 }
Пример #4
0
 // Start is called before the first frame update
 void Start()
 {
     game         = FindObjectOfType <Game>();
     convoHandler = FindObjectOfType <ConvoHandler>();
 }