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

        execute_animations(cmd, time);
    }
Пример #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);
    }
Пример #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);
     }
 }
Пример #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>();
 }
Пример #5
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();
     }
 }
Пример #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();
     }
 }
Пример #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));
            }
        }
    }
Пример #8
0
 // Use this for initialization
 void Start()
 {
     //bring in variables from the play space script.
     playSpace = GameObject.FindObjectOfType <PlaySpace>();
 }
Пример #9
0
 public virtual void execute_command(string command)
 {
     Debug.Log("EvoLangImplementation.execute_command()");
     execute_animations(command.ToLower(), 1.0f / PlaySpace.GetVelocity());
 }
Пример #10
0
 void Awake()
 {
     //Value.test();
     instance = this;
 }