Esempio n. 1
0
    public bool StartNPCConversation(GameObject npc)
    {
        //Make the npc turn to face you
        Move moveScript = npc.GetComponent <Move>();

        if (moveScript != null)
        {
            moveScript.SetFacingDirectionLogic(MoveScripts.GetOppositeDirection(move.lookDirection));
        }

        //Check if the npc is a trainer and set the appropriate route
        string route = "";

        if (npc.GetComponent <TrainerLogic>() != null)
        {
            if (npc.GetComponent <TrainerLogic>().defeated)
            {
                route = "Trainer Defeated";
            }
        }

        //Check if the npc has a cutscene attached and run it.
        PackedCutscene c = new PackedCutscene(npc.GetComponent <Cutscene>());

        if (c != null)
        {
            sr.battleSetup.StartCutscene(c, route);
        }
        else
        {
            return(false);
        }

        return(true);
    }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (sr.battleSetup.PlayerCanMove() && !move.isMoving)
     {
         if (Input.GetButtonDown("Submit"))
         {
             Vector2      faceDirection = MoveScripts.GetVector2FromDirection(MoveScripts.GetOppositeDirection(move.lookDirection));
             Vector2      checkPoint    = MoveScripts.GetFrontVector2(move, 1, true);
             Collider2D[] hit           = Physics2D.OverlapAreaAll(checkPoint, checkPoint);
             InteractBegin(hit);
         }
     }
 }