Inheritance: MonoBehaviour
Ejemplo n.º 1
0
	public ElectrocuteAction(RobotController controller, List<Goal> goals, Label target)
		: base(controller, goals, target.labelHandle) {
		this.name = "electrocute";
		this.target = target;
		requiredComponents = new System.Type[] { };

	}
Ejemplo n.º 2
0
 public PursueAction(RobotController controller, List<Goal> goals, Label target)
     : base(controller, goals, target.gameObject)
 {
     this.target = target;
     this.name = "pursue";
     requiredComponents = new System.Type[] {typeof(HoverJet)};
 }
Ejemplo n.º 3
0
	public override Endeavour constructEndeavour(RobotController controller) {
		if(parent == null) {
			return null;
		}

		return new GuardAction(controller, goals, parent);
	}
Ejemplo n.º 4
0
    public void ResetRobotObject()
    {
        Vector3    robotPosition  = Vector3.zero;
        Quaternion robotRotation  = Quaternion.identity;
        Quaternion cameraRotation = Quaternion.identity;

        cameraRotation.x = 90f;
        //Start by trying to find a robot if it already exists.
        robotObject = GameObject.Find("Robot");
        //If the robot does exist, destroy it.
        if (robotObject != null)
        {
            robotManager.DestroySensors();
            Destroy(robotObject);
            RobotManager.robotCam.transform.SetParent(null);
            RobotManager.cameraAudioListener.enabled = true;
            Debug.Log("ResetRobotObject() - cameraAudioListener.enabled? " + RobotManager.cameraAudioListener.enabled);
            //RobotController.initialized = false;
        }
        //Whether a previous robot existed or not, instantiate a new one.
        robotObject     = GameObject.Instantiate(robotPrefab, robotPosition, robotRotation);
        robotController = robotObject.GetComponent <RobotController>();
        robotManager.InitializeRobot();

        SetupCameraPOV();
        Debug.Log(RobotManager.robotCam.name + " has parent " + RobotManager.robotCam.transform.parent.name);
        //Debug.Log("ResetRobotObject(): position - " + robotObject.transform.position.ToString() + " orientation - " + robotObject.transform.rotation.ToString());
        //robotObject.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
    }
Ejemplo n.º 5
0
        //Testing if the Robot Index action returns a non null view
        public void TestNotNullRobotIndex()
        {
            var        robCon = new RobotController();
            ViewResult result = robCon.Index("") as ViewResult;

            Assert.NotNull(result);
        }
Ejemplo n.º 6
0
    public void Update()
    {
        unlocked = DocumentClass.noGenerators == 0;

        Collider[] collide = Physics.OverlapSphere(this.transform.position, RangeConst);

        bool ok = false;

        foreach (Collider c in collide)
        {
            RobotController rc = c.GetComponentInParent <RobotController> ();
            if (rc != null)
            {
                ok = true;
            }
        }

        if (!ok)
        {
            return;
        }

        Debug.Log("gen: " + DocumentClass.noGenerators);

        if (unlocked)
        {
            GetComponentInParent <DocumentClass> ().GetComponentInChildren <ChangeText>().chgtxt("You won!");
//Debug.Log(1/(DocumentClass.noGenerators));
        }
    }
Ejemplo n.º 7
0
        private void TextBoxDirectCommands_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                try
                {
                    // Add the command identifier and a wait time, if it was not supplied
                    string command = TextBoxDirectCommands.Text;
                    if (!command.StartsWith(RobotMessageResultServer.IDENTIFIER_GO))
                    {
                        command =
                            RobotMessageResultServer.IDENTIFIER_GO + CommunicationConstants.MSG_SUB_DELIMITER +
                            "0" + CommunicationConstants.MSG_SUB_DELIMITER +
                            command;
                    }

                    // Check whether the translation would raise an exception
                    RobotTranslator.DecodeTo(command);

                    // Submit the command
                    RobotController.SubmitCommand(command);

                    // Clear message window
                    TextBoxDirectCommands.Text = "";
                }
                catch (Exception)
                {
                    LogMessage("Invalid command!");
                }
            }
        }
Ejemplo n.º 8
0
        private void Start()
        {
            if (target == null)
            {
                target = FindObjectOfType <RobotController>();
            }

            if (ErrorText == null)
            {
                SetupErrorText();
            }

            SPRITE_SHEET  = Resources.LoadAll <Sprite>("software_minigame/Sprites/greenSheet");
            draggableList = GetComponent <GenericDraggableList>();

            playButton.EventHandler += Play;
            stopButton.EventHandler += Stop;

            stopButton.GetComponent <Image>().color = new Color(.6f, .6f, .6f);

            if (LevelGenerator == null)
            {
                LevelGenerator = FindObjectOfType <SoftwareLevelGenerator>();
            }
        }
 private void Start()
 {
     animator        = GetComponent <Animator>();
     karelController = transform.root.GetComponent <RobotController>();
     controls        = transform.root.GetComponent <ThirdPersonUserControl>();
     charControl     = transform.root.GetComponent <ThirdPersonCharacter>();
 }
        public void Run_NullStreams_NoThrow()
        {
            var robot      = new Robot();
            var controller = new RobotController(robot);

            controller.Run(null, null);
        }
 protected void applyPlayerKnowledge(RobotController controller)
 {
     Player[] players = FindObjectsOfType<Player>();
     foreach(Player player in players) {
         controller.addKnownLocation(player.GetComponent<Label>());
     }
 }
Ejemplo n.º 12
0
        //Testing if the Robot RobotArrows action returns a non null view
        public void TestNotNullRobotArrows()
        {
            var        controller = new RobotController();
            ViewResult result     = controller.RobotArrows(1) as ViewResult;

            Assert.NotNull(result);
        }
Ejemplo n.º 13
0
        public override void Execute(RobotController target, InstructionExecutor executor)
        {
            instructionExecutor = executor;
            this.target         = target;

            t     = 0;
            start = target.transform.position;
            end   = start;
            switch (moveDirection)
            {
            case Directions.Up:
                end += new Vector3(0, 1, 0);
                break;

            case Directions.Down:
                end += new Vector3(0, -1, 0);
                break;

            case Directions.Left:
                end += new Vector3(-1, 0, 0);
                break;

            case Directions.Right:
                end += new Vector3(1, 0, 0);
                break;
            }

            moving = true;
        }
Ejemplo n.º 14
0
    void UpdateTarget()
    {
        GameObject[] enemies          = GameObject.FindGameObjectsWithTag(enemyTag);
        float        shortestDistance = Mathf.Infinity;
        GameObject   nearestEnemy     = null;

        foreach (GameObject enemy in enemies)
        {
            float distanceToEnemy = Vector3.Distance(transform.position, enemy.transform.position);
            if (distanceToEnemy < shortestDistance)
            {
                shortestDistance = distanceToEnemy;
                nearestEnemy     = enemy;
            }
        }

        if (nearestEnemy != null && shortestDistance <= range)
        {
            target      = nearestEnemy.transform;
            targetEnemy = nearestEnemy.GetComponent <RobotController>();
        }
        else
        {
            target = null;
        }
    }
Ejemplo n.º 15
0
    public void PlaceRobot(RobotController robot, int x, int y)
    {
        TileController loc = FindTile(x, y);

        loc.LoadRobotOnTileMesh(robot.isOpponent);
        robot.transform.localPosition = new Vector3(loc.transform.localPosition.x, loc.transform.localPosition.y, -loc.transform.localScale.z * 0.1f);
    }
Ejemplo n.º 16
0
    public void loopTask()
    {
        double[]        inputs = GetMovement();
        RobotController associatedController = associatedObject.GetComponent(typeof(RobotController)) as RobotController;

        associatedController.drive(inputs[0], inputs[1]);
    }
Ejemplo n.º 17
0
    void Start()
    {
        xpos       = xstart;
        ypos       = ystart;
        randomize  = 0;
        prevUDP    = 17; // some out of range number
        gridNumber = xpos + (ypos - 1) * 10;
        robot      = GameObject.Find("Robot").gameObject.GetComponent <RobotController>();
        ball       = GameObject.Find("Ball 1").gameObject.GetComponent <BallController>();
        // Initialize the reference for other game objects (Implementation Specific)
        ic1 = GameObject.Find("Indicator 1").gameObject.GetComponent <IndicatorController>();
        ic2 = GameObject.Find("Indicator 2").gameObject.GetComponent <IndicatorController>();
        ic3 = GameObject.Find("Indicator 3").gameObject.GetComponent <IndicatorController>();
        ic4 = GameObject.Find("Indicator 4").gameObject.GetComponent <IndicatorController>();
        // ic5 = GameObject.Find("Indicator 5").gameObject.GetComponent<IndicatorController>();
        timingBar = GameObject.Find("Timing Bar").gameObject.GetComponent <TimingBarFiveController>();

        // Define grid color
        color.r = 0.5f;
        color.g = 0.5f;
        color.b = 0.5f;

        Debug.Log("Test: Ball " + randomize.ToString());
        ignore = 0;
    }
Ejemplo n.º 18
0
 public HoldAction(RobotController controller, Label target, GameObject source)
     : base(controller, new List<Goal>{new Goal(GoalEnum.Offense, 3), new Goal(GoalEnum.Protection, 3)}, source)
 {
     this.target = target;
     this.name = "grab";
     requiredComponents = new System.Type[] {typeof(RobotArms)};
 }
Ejemplo n.º 19
0
    public override void OnActionReceived(float[] vectorAction)
    {
        RobotController   robotController   = robotArm.GetComponent <RobotController>();
        PincherController pincherController = robotHand.GetComponent <PincherController>();

        for (int i = 0; i < robotController.joints.Length + 1; i++)
        {
            float inputVal = vectorAction[i];

            if (i == 7)
            {
                pincherController.gripState = GripStateForInput(inputVal);
            }

            else
            {
                if (Mathf.Abs(inputVal) > 0)
                {
                    RotationDirection direction = GetRotationDirection(inputVal);
                    robotController.RotateJoint(i, direction);
                    return;
                }
            }
        }

        robotController.StopAllJointRotations();

        if (cube.position.y < 0.778f)
        {
            EndEpisode();
        }
    }
 public void Turn(RobotController other)
 {
     /*direction = rc.dire >= 3 ? 0 : rc.dire + 1;
         rc.Turn(direction);
         rc.Zoning();*/
         GetComponent<Turn>().RunPanel(other.gameObject);
 }
Ejemplo n.º 21
0
    public void setShooter(GameObject shooter)
    {
        this.shooter = shooter;
        RobotController rc = this.shooter.GetComponent <RobotController>();

        rc.health += this.shooterHealthChange;
    }
Ejemplo n.º 22
0
 private void ChangeLayer(RobotController r, int l)
 {
     if (r != null)
     {
         ChangeLayer(r.gameObject, l);
     }
 }
    public void Save(RobotController robot)
    {
        nivel  = robot.level - 1;
        player = PlayerPrefs.GetInt("UserNumber") + 1;

        if (PlayerPrefs.HasKey("First" + player + nivel))
        {
            PlayerPrefs.SetFloat("TimeTotal" + nivel + player, PlayerPrefs.GetFloat("TimeTotal" + nivel + player) + robot.floatCount);
        }

        if (!PlayerPrefs.HasKey("First" + player + nivel))
        {
            PlayerPrefs.SetString("Player" + player, PlayerPrefs.GetString("User"));
            PlayerPrefs.SetInt("Level" + nivel + player, nivel);
            PlayerPrefs.SetInt("Stars" + nivel + player, robot.stars);
            PlayerPrefs.SetInt("Check" + player, nivel);
            PlayerPrefs.SetFloat("Time" + nivel + player, robot.floatCount);
            PlayerPrefs.SetInt("First" + player + nivel, 1);
            PlayerPrefs.SetFloat("TimeTotal" + nivel + player, robot.floatCount);
        }
        else if (robot.unlock == 2 && robot.floatCount < PlayerPrefs.GetFloat("Time" + nivel + player))
        {
            PlayerPrefs.SetString("Player" + player, PlayerPrefs.GetString("User"));
            PlayerPrefs.SetInt("Level" + nivel + player, nivel);
            PlayerPrefs.SetInt("Stars" + nivel + player, robot.stars);
            PlayerPrefs.SetFloat("Time" + nivel + player, robot.floatCount);

            if (robot.level > PlayerPrefs.GetInt("Check" + player))
            {
                PlayerPrefs.SetInt("Check" + player, nivel);
            }
        }
    }
 public RechargeAction(EndeavourFactory factory, RobotController controller, List<Goal> goals, Dictionary<TagEnum, Tag> tagMap, Battery battery)
     : base(factory, controller, goals, tagMap)
 {
     powerStation = getTagOfType<Tag>(TagEnum.PowerStation);
     this.name = "recharge";
     this.battery = battery;
 }
Ejemplo n.º 25
0
 protected virtual void Start()
 {
     robotController = GetComponent <RobotController>();
     robotCharacter  = GetComponent <RobotCharacter>();
     robotWeapon     = GetComponent <RobotWeapon>();
     robotMovement   = GetComponent <RobotMovement>();
 }
Ejemplo n.º 26
0
 public InvestigateAction(RobotController controller, List<Goal> goals, LabelHandle parent)
     : base(controller, goals, parent)
 {
     creationTime = System.DateTime.Now;
     this.name = "investigate";
     requiredComponents = new System.Type[] { typeof(HoverJet) };
 }
Ejemplo n.º 27
0
        public override bool Execute(ExecutionInfo exInfo = null)
        {
            Result = false;
            if (FilePath.IsValid && Write)
            {
                if (Options == null)
                {
                    Options = new RobotConversionOptions(true);
                }

                Document.Model.GenerateNodes(new NodeGenerationParameters());
                var robot = new RobotController();
                robot.Message += HandleMessage;
                RobotIDMappingTable idMap = null;
                if (Document.IDMappings.ContainsKey(FilePath))
                {
                    idMap = Document.IDMappings[FilePath] as RobotIDMappingTable;
                }
                if (idMap == null)
                {
                    idMap = Document.IDMappings.GetLatest(".rtd") as RobotIDMappingTable;
                }
                if (idMap == null)
                {
                    idMap = new RobotIDMappingTable();
                    Document.IDMappings.Add(FilePath, idMap);
                }
                robot.UpdateRobotFromModel(FilePath, Model, ref idMap, Options);
                //robot.WriteModelToRobot(FilePath, Document.Model, ref idMap);
                robot.Close();
                robot.Release();
                Result = true;
            }
            return(true);
        }
Ejemplo n.º 28
0
 // Start is called before the first frame update
 void Start()
 {
     Controller    = FindObjectOfType(typeof(RobotController)) as RobotController;
     Target        = null;
     TargetFoundBy = null;
     LineFoundBy   = new List <LineSensor>();
 }
Ejemplo n.º 29
0
 private List <Command> AddCommands(RobotController robot)
 {
     robot.commands.ForEach(c => c.robotId = robot.id);
     uiController.ColorCommandsSubmitted(robot.id, robot.isOpponent);
     uiController.ChangeToBoardLayer(robot);
     return(robot.commands);
 }
Ejemplo n.º 30
0
 private void ButtonTakeDebugSnapshot_Click(object sender, RoutedEventArgs e)
 {
     if (_captureInProgress)
     {
         RobotController.TakeDebugSnapshot();
     }
 }
Ejemplo n.º 31
0
    private void RobotController_OnRobotDeath(RobotController robot)
    {
        robotAlive = false;
        Image img = GetComponent <Image>();

        img.fillAmount = 0;
    }
Ejemplo n.º 32
0
 public RechargeAction(RobotController controller, List <Goal> goals, Label target, Battery battery) : base(controller, goals, target.labelHandle)
 {
     powerStation       = target;
     this.name          = "recharge";
     requiredComponents = new System.Type[] { typeof(HoverJet) };
     this.battery       = battery;
 }
Ejemplo n.º 33
0
    private void initBullet(Vector3 direction, GameObject target)
    {
        RaycastHit hit;

        if (Physics.Raycast(new Ray(transform.position, direction), out hit))
        {
            if (target && hit.collider.gameObject != target)
            {
                return;
            }

            RobotController robot = hit.collider.GetComponent <RobotController>();
            if (robot != null)
            {
                robot.Damage();
            }

            GuardController guard = hit.collider.GetComponent <GuardController>();
            if (guard != null)
            {
                guard.Damage(1);
            }

            LineRenderer lineRenderer = GetComponent <LineRenderer>();
            lineRenderer.SetVertexCount(2);
            lineRenderer.SetPosition(0, transform.position);
            lineRenderer.SetPosition(1, hit.point);

            Instantiate(Resources.Load("Sparks") as GameObject, hit.point, Quaternion.identity);
        }
    }
Ejemplo n.º 34
0
        private void BuildClassTabs()
        {
            foreach (var cl in root.classes)
            {
                int columnCount = RobotController.GetHorizontalCount(cl.Layout);
                int rowCount    = RobotController.GetVerticalCount(cl.Layout);

                dgv_class.AutoSizeColumnsMode      = DataGridViewAutoSizeColumnsMode.Fill;
                dgv_class.ScrollBars               = ScrollBars.None;
                dgv_class.RowTemplate.Height       = (dgv_class.Height - dgv_class.ColumnHeadersHeight) / rowCount;
                dgv_class.RowHeadersWidth          = 50;
                dgv_class.AllowUserToOrderColumns  = false;
                dgv_class.AllowUserToResizeColumns = false;
                dgv_class.AllowUserToResizeRows    = false;

                for (int i = 0; i < columnCount + 1; i++)
                {
                    dgv_class.Columns.Add(i.ToString(), i.ToString());
                }

                dgv_class.Rows.Add(rowCount);

                for (int i = 0; i < dgv_class.Rows.Count; i++)
                {
                    dgv_class.Rows[i].HeaderCell.Value = i.ToString();
                }

                PopulateView(cl.Layout);

                lbl_teacherName.Text = cl.Teacher;
                lbl_classId.Text     = cl.ClassId;
                lbl_roomId.Text      = cl.Room;
                lbl_date.Text        = DateTime.Today.ToString("dd-MM-yyyy");
            }
        }
Ejemplo n.º 35
0
 public ElectrocuteAction(RobotController controller, List <Goal> goals, Label target)
     : base(controller, goals, target.labelHandle)
 {
     this.name          = "electrocute";
     this.target        = target;
     requiredComponents = new System.Type[] { };
 }
Ejemplo n.º 36
0
    public void UpdateHealthBarSprite(RobotController robot, SpriteRenderer healthBarSprite)
    {
//		robot = GameObject.Find ("Robot").GetComponent<RobotController> ();
//		healthBarSprite = GameObject.Find ("HealthBar").GetComponent<SpriteRenderer> ();
        if (robot == null)
        {
            healthBarSprite.sprite = fiveHealth;
        }

        switch (robot.health)
        {
        case 5:
            healthBarSprite.sprite = fiveHealth;
            break;

        case 4:
            healthBarSprite.sprite = fourHealth;
            break;

        case 3:
            healthBarSprite.sprite = threeHealth;
            break;

        case 2:
            healthBarSprite.sprite = twoHealth;
            break;

        case 1:
            healthBarSprite.sprite = oneHealth;
            break;
        }
    }
Ejemplo n.º 37
0
        static void Main(string[] args)
        {
            RobotController Robot = new RobotController();

            Robot.Connect("192.168.1.1");
            Console.WriteLine("Robot connecté ... ");

            double cosTeta = 0.649352561565284; //teta=49.50...
            double sinTeta = 0.760487508634168; // sinTeta = System.Math.Cos(45);

            while (true)
            {
                double rX = Robot.GetCurrentPosition().X *cosTeta - Robot.GetCurrentPosition().Y *sinTeta;
                double rY = Robot.GetCurrentPosition().X *sinTeta + Robot.GetCurrentPosition().Y *cosTeta;

                //while((30 <= rX <= -30)&&(30 <= rY <= -20)&&(Robot.GetCurrentPosition().Z < 5))
                //if ((-300 >= rX) && (rX >= 300) && (-200 >= rY) && (rY >= 300) && (Robot.GetCurrentPosition().Z <= 50))
                if ((-200 <= rX) && (rX <= 800) && (130 <= rY) && (rY <= 790) && (Robot.GetCurrentPosition().Z >= 50))
                {
                    //move robot
                    Console.WriteLine("Robot reste dans la zone de securité YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
                    Console.WriteLine("Robot position : x:" + Robot.GetCurrentPosition().X + "; y:" + Robot.GetCurrentPosition().Y + "; z: " + Robot.GetCurrentPosition().Z);
                    Console.WriteLine("   Rotation de X : " + rX + "; Y : " + rY);
                }
                else
                {
                    //robot s'arrete
                    Console.WriteLine("!!! Robot a sorti de la zone de securité !!!!!!!!!!!!!!!!!!!!!!!");
                    Console.WriteLine("Robot position : x:" + Robot.GetCurrentPosition().X + "; y:" + Robot.GetCurrentPosition().Y + "; z: " + Robot.GetCurrentPosition().Z);
                    Console.WriteLine("   Rotation de X : " + rX + "; Y : " + rY);
                }
                System.Threading.Thread.Sleep(2000);
            }
        }
Ejemplo n.º 38
0
    public void ResetRobotObject()
    {
        Vector3    robotPosition  = Vector3.zero;
        Quaternion robotRotation  = Quaternion.identity;
        Quaternion cameraRotation = Quaternion.identity;

        cameraRotation.x = 90f;
        if (robotObject != null)
        {
            robotManager.DestroySensors();
            RobotManager.robotCam.transform.SetParent(null);
            RobotManager.cameraAudioListener.enabled = true;
            //RobotController.initialized = false;
            Destroy(robotObject);
        }
        robotObject     = GameObject.Instantiate(robotPrefab, robotPosition, robotRotation);
        robotController = robotObject.GetComponent <RobotController>();
        robotManager.InitializeRobot();

        RobotManager.robotCam.transform.SetParent(robotObject.transform);
        RobotManager.robotCam.transform.position = robotObject.transform.position + new Vector3(0f, 500f, 0f);
        RobotManager.robotCam.transform.rotation = robotObject.transform.rotation;
        RobotManager.robotCam.transform.Rotate(new Vector3(90f, 0f, 0f));
        Debug.Log(RobotManager.robotCam.name + " has parent " + RobotManager.robotCam.transform.parent.name);
        //Debug.Log("ResetRobotObject(): position - " + robotObject.transform.position.ToString() + " orientation - " + robotObject.transform.rotation.ToString());
        //robotObject.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
    }
        static void Main(string[] args)
        {
            RobotController Robot = new RobotController();
            Robot.Connect("192.168.1.1");
            Console.WriteLine("Robot connecté ... ");

            double cosTeta = 0.649352561565284; //teta=49.50...
            double sinTeta = 0.760487508634168; // sinTeta = System.Math.Cos(45);

            while(true)
            {
                double rX =  Robot.GetCurrentPosition().X * cosTeta - Robot.GetCurrentPosition().Y * sinTeta;
                double rY =  Robot.GetCurrentPosition().X * sinTeta + Robot.GetCurrentPosition().Y * cosTeta;

                //while((30 <= rX <= -30)&&(30 <= rY <= -20)&&(Robot.GetCurrentPosition().Z < 5))
                //if ((-300 >= rX) && (rX >= 300) && (-200 >= rY) && (rY >= 300) && (Robot.GetCurrentPosition().Z <= 50))
                if ((-200 <= rX) && (rX <= 800) && (130 <= rY) && (rY <= 790) && (Robot.GetCurrentPosition().Z >= 50))
                {
                   //move robot
                    Console.WriteLine("Robot reste dans la zone de securité YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
                    Console.WriteLine("Robot position : x:" + Robot.GetCurrentPosition().X + "; y:" + Robot.GetCurrentPosition().Y + "; z: " + Robot.GetCurrentPosition().Z);
                    Console.WriteLine("   Rotation de X : " + rX +"; Y : " + rY);
                }
                else
                {
                    //robot s'arrete
                    Console.WriteLine("!!! Robot a sorti de la zone de securité !!!!!!!!!!!!!!!!!!!!!!!");
                    Console.WriteLine("Robot position : x:" + Robot.GetCurrentPosition().X + "; y:" + Robot.GetCurrentPosition().Y + "; z: " + Robot.GetCurrentPosition().Z);
                    Console.WriteLine("   Rotation de X : " + rX + "; Y : " + rY);
                }
                System.Threading.Thread.Sleep(2000);
            }
        }
 public void Recover(RobotController other)
 {
     other.hp += 10;
     if(other.mhpCurrent< other.hp)
     {
         other.hp = other.mhpCurrent;
     }
 }
Ejemplo n.º 41
0
 public int getConcurrentExecutions(RobotController executor, System.Type endeavourType)
 {
     HashSet<RobotController> endeavourExecutors = getExecutors(endeavourType);
     if (endeavourExecutors.Contains(executor)) {
         return endeavourExecutors.Count - 1;
     }
     return endeavourExecutors.Count;
 }
 public Endeavour constructEndeavour(RobotController controller, List<Tag> tags)
 {
     Dictionary<TagEnum, Tag> tagMap = new Dictionary<TagEnum, Tag>();
     foreach (Tag tag in tags) {
         tagMap.Add(tag.type, tag);
     }
     return createEndeavour(controller, tagMap);
 }
Ejemplo n.º 43
0
 public RechargeAction(RobotController controller, List<Goal> goals, Label target, Battery battery)
     : base(controller, goals, target.labelHandle)
 {
     powerStation = target;
     this.name = "recharge";
     requiredComponents = new System.Type[] { typeof(HoverJet) };
     this.battery = battery;
 }
 public InvestigateAction(EndeavourFactory factory, RobotController controller, List<Goal> goals, Dictionary<TagEnum, Tag> tags)
     : base(factory, controller, goals, tags)
 {
     //creationTime = System.DateTime.Now;
     creationTime = Time.time;
     this.name = "investigate";
     sound = getTagOfType<Tag>(TagEnum.Sound);
 }
Ejemplo n.º 45
0
    public override Endeavour constructEndeavour(RobotController controller) {
		Battery battery = controller.GetComponentInChildren<Battery>();
		if (parent == null || battery == null) {
            return null;
        }
		RechargeAction action = new RechargeAction(controller, goals, parent, battery);
		action.rechargePoint = rechargePoint;
        return action;
    }
 public void addListener(RobotController listener)
 {
     RobotAntenna antenna = listener.getRobotComponent<RobotAntenna>();
     if (antenna != null) {
         forceAddListener(listener);
     } else {
         Debug.LogWarning("Cannot add robot without antenna to CRC: " + listener.name);
     }
 }
Ejemplo n.º 47
0
	public override Endeavour constructEndeavour (RobotController controller) {
		if (parent == null) {
			return null;
		}
		//Goal[] goals = new Goal[2];
		//goals [0] = new Goal ("protection", 3);
		//goals [1] = new Goal ("offense", 3);
		return new PursueAction(controller, goals, parent);
	}
Ejemplo n.º 48
0
	public override Endeavour constructEndeavour (RobotController controller) {
		if (parent == null || getPoints() == null || getPoints().Count == 0) {
			if(getPoints().Count == 0) {
				Debug.LogWarning("Patrol route '"+parent.name+"' has no route points");
			}
			return null;
		}
		return new PatrolAction(controller, goals, getPointHandles(), parent);
	}
 public RobotController getController()
 {
     if (roboController == null) {
         roboController = GetComponentInParent<RobotController>();
         if (roboController == null)
             Debug.LogWarning("Robot component '" + name + "' is not attached to a robot controller!");
     }
     return roboController;
 }
Ejemplo n.º 50
0
	public override Endeavour constructEndeavour (RobotController controller) {
		if (parent == null) {
			return null;
		}
		//Goal[] goals = new Goal[2];
		//goals[0] = new Goal ("protection", 5);
		//goals[1] = new Goal ("offense", 5);
		//Debug.Log ("get drop");
		return new DropKickAction(controller, goals, parent.labelHandle);
	}
Ejemplo n.º 51
0
    void Start()
    {
        this.shooterMode = this.GetComponent<KaneShooterController> ();
        this.robotMode = this.GetComponent<RobotController> ();

        this.robotMode.enabled = this.starts [0];
        this.shooterMode.enabled = this.starts [1];

        this.shooterMode.start ();
    }
Ejemplo n.º 52
0
 protected override Endeavour createEndeavour(RobotController controller, Dictionary<TagEnum, Tag> tags)
 {
     Battery battery = controller.GetComponentInChildren<Battery>();
     if (battery == null) {
         return null;
     }
     RechargeAction action = new RechargeAction(this, controller, goals, tags, battery);
     action.rechargePoint = rechargePoint;
     return action;
 }
Ejemplo n.º 53
0
    public PatrolAction(EndeavourFactory factory, RobotController controller, List<Goal> goals, Dictionary<TagEnum, Tag> tagMap)
        : base(factory, controller, goals, tagMap)
    {
        this.name = "patrol";

        PatrolTag patrolTag = getTagOfType<PatrolTag>(TagEnum.PatrolRoute);
        if (patrolTag.getPoints() == null || patrolTag.getPoints().Count == 0) {
            Debug.LogWarning("Patrol route '" + patrolTag.getLabelHandle().label.name + "' has no route points");
        }
        routePoints = patrolTag.getPointHandles();
    }
Ejemplo n.º 54
0
 public virtual List<Endeavour> getAvailableEndeavours(RobotController controller)
 {
     List<Endeavour> availableEndeavours = new List<Endeavour> ();
     foreach (EndeavourFactory endeavour in endeavours) {
         Endeavour newEndeavour = endeavour.constructEndeavour(controller);
         if(newEndeavour != null) {
             availableEndeavours.Add(newEndeavour);
         }
     }
     return availableEndeavours;
 }
Ejemplo n.º 55
0
	// Use this for initialization
	void Awake () {
		roboController = GetComponentInParent<RobotController> ();
        if (roboController == null) {
            Debug.LogWarning("Robot component '" + name + "' is not attached to a robot controller!");
        } else {
            powerSource = roboController.GetComponentInChildren<AbstractPowerSource>();

        }
        if (roboController == null) {
            Debug.LogWarning("Robot component '" + name + "' has no power source!");
        }

    }
Ejemplo n.º 56
0
	public PatrolAction(RobotController controller, List<Goal> goals, List<LabelHandle> route, Label target)
		: base(controller, goals, target.labelHandle) {
		//this.route = route;
		this.name = "patrol";
		requiredComponents = new System.Type[] {typeof(HoverJet)};
		//this.points = route;
		//routePoints = new List<Label> ();
		routePoints = route;
		/*foreach (GameObject point in points) {
			Label label = point.GetComponent<Label>();
			if (label != null) {
				routePoints.Add(label);
			}
		}*/
	}
 // Constructeur permettant de ce connecter au robot
 public Class_Kuka_Manager()
 {
     if (debug)
     {
         robot = new RobotController();
         try
         {
             robot.Connect("192.168.1.1");
             Console.WriteLine("coonected");
         }
         catch (IOException e)
         {
             Console.WriteLine(e);
         }
     }
 }
Ejemplo n.º 58
0
        static void Main(string[] args)
        {
            RobotController Robot = new RobotController();
            Robot.Connect("192.168.1.1");
            Console.WriteLine("Robot connecté ... ");
            Console.WriteLine("Robot position : x:" + Robot.GetCurrentPosition().X + "; y:" + Robot.GetCurrentPosition().Y + "; z: " + Robot.GetCurrentPosition().Z);

            List<CartesianPosition> Trajectoire = new List<CartesianPosition>();
            for (int i = 1; i <= 100; i++)
            {

                Trajectoire.Add(new CartesianPosition
                {
                    X = i + Robot.GetCurrentPosition().X,
                    Y = i + Robot.GetCurrentPosition().Y,
                    Z = i + Robot.GetCurrentPosition().Z,
                    A = 0 + Robot.GetCurrentPosition().A,
                    B = 0 + Robot.GetCurrentPosition().B,
                    C = 0 + Robot.GetCurrentPosition().C

                });
            }
            //Robot.PlayTrajectory(Trajectoire);

            Robot.StartRelativeMovement();
            CartesianPosition Test = new CartesianPosition
            {

                X = -1,
                Y = 0,
                Z = 0,
                A = 0,
                B = 0,
                C = 0
            };

            Robot.SetRelativeMovement(Test);
            System.Threading.Thread.Sleep(2000);
            Robot.StopRelativeMovement();

            Device Mouse = new Device();
        }
Ejemplo n.º 59
0
	void Update() {
		if(isScanning()) {
			currentScanTime += Time.deltaTime;
		}

		if(currentScanTime > scanTime) {
			currentScanTime = 0;
			stopScan();
			if(currentController == null) {
				currentController = GetComponentInParent<RobotController>();
			}
			currentController.enqueueMessage(new RobotMessage(RobotMessage.MessageType.ACTION, "target scanned", null, new Vector3(), null));
		}


		if(active) {
			if(!soundEmitter.isPlaying) {
			//soundEmitter.clip = scanSound;
				soundEmitter.PlayOneShot(scanSound);
			}
			float movementRate = 4f*movementRange/(scanTime);
			drawLines();
			if(movingUp) {
				upness += Time.deltaTime * movementRate;
				if(upness > movementRange) {
					movingUp = false;
				}
			} else {
				upness -= Time.deltaTime * movementRate;
				if(Mathf.Abs(upness) > movementRate) {
					movingUp = true;
				}
			}
		} else {
			if(soundEmitter.isPlaying) {
				soundEmitter.Stop();
			}
			clearLines();
		}
	}
 /// <summary>
 /// あらかじめ指定されたパネル効果を実行
 /// </summary>
 public void Run(RobotController other)
 {
     if (mikata == other.Mikata && !process)
     {
         switch (targetNo)
         {
             case 0://移動
                 Turn(other);
                 break;
             case 1:
                 Destruct(other);
                 break;
             case 2:
                 Stop(other);
                 break;
             case 3:
                 Recover(other);
                 break;
         }
         process = true;
         GetComponent<Animator>().SetTrigger("PanelEffect");
     }
 }