Exemple #1
0
    public override void execute_command(string command)
    {
        float  time = 1.0f / PlaySpace.GetVelocity();
        string cmd  = command.ToLower();

        execute_animations(cmd, time);
    }
Exemple #2
0
    public override void execute_command(string command)
    {
        float  time = 1.0f / PlaySpace.GetVelocity();
        string cmd  = command.ToLower();

        if (cmd.Equals("walk"))
        {
            float xDistance = Mathf.Sin(myTransform.parent.localEulerAngles.y * Mathf.PI / 180.0f) * PlaySpace.GetBaseDistance();
            float zDistance = Mathf.Cos(myTransform.parent.localEulerAngles.y * Mathf.PI / 180.0f) * PlaySpace.GetBaseDistance();
            StartCoroutine(Move_Coroutine_X(myTransform.parent, xDistance, time));
            StartCoroutine(Move_Coroutine_Z(myTransform.parent, zDistance, time));
        }
        else if (cmd.Equals("run"))
        {
            float xDistance = Mathf.Sin(myTransform.parent.localEulerAngles.y * Mathf.PI / 180.0f) * 3 * PlaySpace.GetBaseDistance();
            float zDistance = Mathf.Cos(myTransform.parent.localEulerAngles.y * Mathf.PI / 180.0f) * 3 * PlaySpace.GetBaseDistance();
            StartCoroutine(Move_Coroutine_X(myTransform.parent, xDistance, time));
            StartCoroutine(Move_Coroutine_Z(myTransform.parent, zDistance, time));
        }
        else if (cmd.Equals("turnright"))
        {
            StartCoroutine(Rotate_Coroutine_Y(myTransform.parent, 90, time));
        }
        else if (cmd.Equals("turnleft"))
        {
            StartCoroutine(Rotate_Coroutine_Y(myTransform.parent, -90, time));
        }
        else
        {
            Debug.Log("Could not run cmd " + cmd + ".");
        }
        execute_animations(cmd, time);
    }
Exemple #3
0
 void OnTriggerEnter2D(Collider2D hitInfo)
 {
     if (hitInfo.name == "ball")
     {
         string wallName = transform.name;
         PlaySpace.Score(wallName);
         hitInfo.gameObject.SendMessage("RestartGame", 1.0f, SendMessageOptions.RequireReceiver);
     }
 }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     foreach (Transform child in transform)
     {
         GameObject enemy = Instantiate(enemyType, child.transform.position, Quaternion.identity) as GameObject;
         enemy.transform.parent = child;
     }
     //bring in variables from the play space script.
     playSpace = GameObject.FindObjectOfType <PlaySpace>();
 }
 void Awake()
 {
     objTransform = this.GetComponent<Transform>();
     parentTransform = objTransform.parent;
     if (playSpace == null)
         playSpace = GetPlaySpaceInAncestrals(objTransform);
     playSpaceTransform = playSpace.GetComponent<Transform>();
     if (isRoot)
     {
         parentTransform.gameObject.SetActive(false);
         Register();
     }
 }
Exemple #6
0
 void Awake()
 {
     objTransform    = this.GetComponent <Transform>();
     parentTransform = objTransform.parent;
     if (playSpace == null)
     {
         playSpace = GetPlaySpaceInAncestrals(objTransform);
     }
     playSpaceTransform = playSpace.GetComponent <Transform>();
     if (isRoot)
     {
         parentTransform.gameObject.SetActive(false);
         Register();
     }
 }
Exemple #7
0
    private IEnumerator RunScriptCoroutine()
    {
        float         time       = 1.0f / PlaySpace.GetVelocity();
        string        path       = Application.persistentDataPath + "/SourceCodes/" + scriptName;
        string        sourceCode = File.ReadAllText(path);
        List <string> commands   = new List <string>(sourceCode.Split(';'));

        foreach (string splittedCommand in commands)
        {
            string cmd = splittedCommand.Trim();
            if (cmd.Length > 0)
            {
                //Debug.Log(this.gameObject.name + " running command " + cmd + ".");
                foreach (EvoLangImplementation libraryImplementation in librariesSupported)
                {
                    libraryImplementation.execute_command(cmd);
                }
                yield return(new WaitForSeconds(time));
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     //bring in variables from the play space script.
     playSpace = GameObject.FindObjectOfType <PlaySpace>();
 }
 public virtual void execute_command(string command)
 {
     Debug.Log("EvoLangImplementation.execute_command()");
     execute_animations(command.ToLower(), 1.0f / PlaySpace.GetVelocity());
 }
Exemple #10
0
 void Awake()
 {
     //Value.test();
     instance = this;
 }