IEnumerator startBall()
    {
        gameStarted = true;
        yield return(new WaitForSeconds(1f));

        target           = ((GameObject)Instantiate(esferaPrefab, esferaPrefab.transform.position, esferaPrefab.transform.rotation)).GetComponent <RobotSphere> ();
        moveCam.Follow   = target.transform;
        moveCam.Priority = 11;
        switch (dificultad)
        {
        case Dificultad.Nivel.facil:
            target.Setup(triggerAltura[0].position.y);
            ajusteFuerza = fuerzaFacil;
            break;

        case Dificultad.Nivel.medio:
            target.Setup(triggerAltura[1].position.y);
            ajusteFuerza = fuerzaMedio;
            break;

        case Dificultad.Nivel.dificil:
            target.Setup(triggerAltura[2].position.y);
            ajusteFuerza = fuerzaDificil;
            break;
        }
    }
Exemple #2
0
        internal AWSLScript(RobotSphere robot, string code)
        {
            this.robot = robot;

            try
            {
                UserData.RegisterAssembly();
                UserData.RegisterProxyType <RobotProxy, RobotSphere>(o => new RobotProxy(o));
                script = new Script(CoreModules.TableIterators | CoreModules.Table);
                script.DoString(code);
                coroutine = script.CreateCoroutine(script.Globals.Get("main"));

                script.Globals["Shared"] = shared;
                script.Globals["Self"]   = robot;

                script.Globals["print"]          = (Action <DynValue>)(x => Debug.Log(x.ToDebugPrintString()));
                script.Globals["forward"]        = FuncMove(Movable.Move.Front);
                script.Globals["backward"]       = FuncMove(Movable.Move.Back);
                script.Globals["left"]           = FuncMove(Movable.Move.Left);
                script.Globals["right"]          = FuncMove(Movable.Move.Right);
                script.Globals["findEnemy"]      = FuncFindNearestEnemy();
                script.Globals["nearestBattery"] = FuncNearestBattery();
                script.Globals["attackEnemy"]    = FuncAttackNearestEnemy();

                coroutine.Coroutine.AutoYieldCounter = 10 * robot.CPU.Speed;
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }
        }
Exemple #3
0
        private void OnTriggerExit(Collider other)
        {
            RobotSphere robotSphere = other.gameObject.GetComponent <RobotSphere>();

            if (robotSphere != null)
            {
                //robotSphere.Battery.UnCharge();
            }
        }
Exemple #4
0
        private IEnumerator AttackPlayer(GameObject player)
        {
            yield return(new WaitForSeconds(0.2f));

            if (player != null)
            {
                RobotSphere enemyBehavior = player.GetComponent <RobotSphere>();
                if (enemyBehavior != null)
                {
                    enemyBehavior.OnHit();
                }
            }
        }
Exemple #5
0
 public RobotProxy(RobotSphere o)
 {
     robot = o;
 }
Exemple #6
0
 public FpsController(CharacterController cc, GameObject gameObject)
 {
     this.cc         = cc;
     this.gameObject = gameObject;
     robotSphere     = gameObject.GetComponent <RobotSphere>();
 }
 public void Init()
 {
     gameStarted     = false;
     target          = null;
     alturaText.text = "Altura: 0 metros";
 }