void ExecMovementInst() { InstructionMovement inst = currentInstruction as InstructionMovement; //calculat the vector *scrapped* the class does that for us //Debug.Log ("I want to do something"); Utilities.RMove(inst.waypoint, inst.speed, entity); if (entity.transform.position == inst.waypoint) { DoneInstructions.Push(new TwoValuePair <float, InstructionData> (world.currTime, currentInstruction)); currentInstruction = null; Debug.Log("Added Instruction To done"); } }
/// <summary> /// Interrupt of current instruction because of an interaction /// </summary> /// <param name="sender">Sender.</param> public void InteractionInteruptStart(Entity sender) { //splitting the last Instruction //we have to do different things depending on what instruction currently happens if (currentInstruction != null) { if (currentInstruction is InstructionMovement) { InstructionMovement full = currentInstruction as InstructionMovement; Instructions.AddFirst(full); DoneInstructions.Push(new TwoValuePair <float, InstructionData> (world.currTime, new InstructionMovement(full.TargetId, full.TriggerTime, entity.transform.position, full.speed))); //now it is just an infinitif wait. } } currentInstruction = new InstructionLookAt(id, world.currTime, 4, 5, -1, 0); (currentInstruction as InstructionLookAt).target = sender.entity; }