public override void Action(Transform interactionArea, ScenarioStep scenarioStep)
    {
        if (!scenarioStep.IsPreviousStepsDone())
        {
            return;
        }

        if (scenarioStep.strings[0] != "" && !Input.GetKeyDown(scenarioStep.strings[0]))
        {
            return;
        }

        if (GameObject.Find("ScenarioManager").GetComponent <Scenario>().endcount == 0)
        {
            GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score -= step.floats[0];
        }

        scenarioStep.IsDone = true;
        GameObject.Find("ScenarioManager").GetComponent <Scenario>().endcount = 0;
        if (!GameObject.FindGameObjectWithTag("TextExit"))
        {
            GameObject.FindGameObjectWithTag("TextExit").SetActive(true);
        }
        Destroy(GameObject.FindGameObjectWithTag("Scenario"), 2f);
    }
Exemple #2
0
    public override void Action(Transform interactionArea, ScenarioStep scenarioStep)
    {
        if (!scenarioStep.IsPreviousStepsDone())
        {
            return;
        }
        if (scenarioStep.gameObjects[0] == null || (interactionArea == scenarioStep.gameObjects[0].transform) || (scenarioStep.gameObjects[0] == GlowEffectRayCaster.Instance.GetCatchedObject()))
        {
            if (scenarioStep.strings[1] != null)
            {
                MessageShow.Instance.ShowMessage(scenarioStep.strings[1]);
            }

            if (scenarioStep.strings[0] != "" && !Input.GetKeyDown(scenarioStep.strings[0]))
            {
                return;
            }

            MessageShow.Instance.ShowMessage("");
            scenarioStep.IsDone = true;
        }
        else
        {
            MessageShow.Instance.ShowMessage("");
        }
    }
 void Update()
 {
     for (int k = 0; k < activeSteps.Count; k++)
     {
         ScenarioStep temp = activeSteps[k];
         if (temp.IsPreviousStepsDone())
         {
             if (temp.stepType == null)
             {
                 temp.stepType = scriptableObjects[temp.scriptableObjectName];
             }
             temp.stepType.Action(interactingObject, temp);
             if (temp.IsDone)
             {
                 activeSteps.Remove(temp);
                 foreach (var next in temp.nextSteps)
                 {
                     if (!activeSteps.Contains(allSteps[next]))
                     {
                         allSteps[next].IsDone = false;
                         activeSteps.Add(allSteps[next]);
                     }
                 }
                 break;
             }
         }
     }
 }
Exemple #4
0
 public virtual void Action(Transform interactionArea, ScenarioStep scenarioStep)
 {
     if (!scenarioStep.IsPreviousStepsDone())
     {
         return;
     }
     if (interactionArea != null && interactionArea == scenarioStep.gameObjects[0])
     {
         return;
     }
 }
    public override void Action(Transform interactionArea, ScenarioStep scenarioStep)
    {
        if (!scenarioStep.IsPreviousStepsDone())
        {
            return;
        }
        bool flagtime = false;

        if (scenarioStep.floats[1] >= 0)
        {
            scenarioStep.floats[1] -= Time.deltaTime;
        }
        if (scenarioStep.floats[1] < 0 && flagtime == false)
        {
            if (GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score >= 0)
            {
                GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score -= scenarioStep.floats[2];
            }
            else
            {
                GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score = 0;
            }
            Debug.Log(GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score);
            scenarioStep.gameObjects[1].SetActive(true);
            MessageShow.Instance.ShowMessage(scenarioStep.strings[2]);
            flagtime = true;
        }

        if (scenarioStep.gameObjects[0] == null || (interactionArea == scenarioStep.gameObjects[0].transform) ||
            (scenarioStep.gameObjects[0] == GlowEffectRayCaster.Instance.GetCatchedObject()))
        {
            if (scenarioStep.strings[1] != null)
            {
                MessageShow.Instance.ShowMessage(scenarioStep.strings[1]);
            }

            if (scenarioStep.strings[0] != "" && !Input.GetKeyDown(scenarioStep.strings[0]))
            {
                return;
            }
            MessageShow.Instance.ShowMessage("");
            scenarioStep.IsDone = true;
            if (scenarioStep.floats[1] >= 0)
            {
                GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score += scenarioStep.floats[3];
            }
            scenarioStep.gameObjects[1].SetActive(false);
            scenarioStep.floats[1] = scenarioStep.floats[0];
        }
    }
Exemple #6
0
 public override void Action(Transform interactionArea, ScenarioStep scenarioStep)
 {
     if (scenarioStep.IsPreviousStepsDone())
     {
         MessageShow.Instance.ShowMessage(scenarioStep.strings[0]);
     }
     scenarioStep.floats[1] -= Time.deltaTime;
     Debug.Log(scenarioStep.floats[1]);
     if (scenarioStep.floats[1] < 0)
     {
         MessageShow.Instance.ShowMessage("");
         scenarioStep.IsDone    = true;
         scenarioStep.floats[1] = scenarioStep.floats[0];
     }
 }
    public override void Action(Transform interactionArea, ScenarioStep scenarioStep)
    {
        if (!scenarioStep.IsPreviousStepsDone())
        {
            return;
        }
        bool flagtime = false;

        if (scenarioStep.floats[1] >= 0)
        {
            scenarioStep.floats[1] -= Time.deltaTime;
            Debug.Log(scenarioStep.floats[1]);
        }
        if (scenarioStep.floats[1] < 0 && flagtime == false)
        {
            GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score = 100;
            if (GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score >= 0)
            {
                GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score -= scenarioStep.floats[2];
            }
            Debug.Log(GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score);
            //scenarioStep.gameObjects[3].SetActive(true);
            MessageShow.Instance.ShowMessage(scenarioStep.strings[2]);
            flagtime = true;
        }
        scenarioStep.gameObjects[2].GetComponent <ColliderCheck>().gameobjectcol1 = scenarioStep.gameObjects[0].tag;
        scenarioStep.gameObjects[2].GetComponent <ColliderCheck>().gameobjectcol2 = scenarioStep.gameObjects[1].tag;

        if (scenarioStep.gameObjects[2].GetComponent <ColliderCheck>().flagobjectcol1&& scenarioStep.gameObjects[2].GetComponent <ColliderCheck>().flagobjectcol2)
        {
            Debug.Log("IsDone");
            MessageShow.Instance.ShowMessage("");
            scenarioStep.IsDone = true;
            if (scenarioStep.floats[1] >= 0)
            {
                GameObject.Find("ScenarioManager").GetComponent <Scenario>().Score += scenarioStep.floats[3];
            }
            scenarioStep.gameObjects[3].SetActive(false);
            scenarioStep.floats[1] = scenarioStep.floats[0];
        }
    }