Example #1
0
 public static Command KillCommand(Transform target, CharacterAI character, float health)
 {
     Command k = Command.CreateInstance <Command> ();
     k.name = "Kill: " + target.name;
     k.time = character.character.CalcDPS () / health;
     k.position = target.position;
     k.type = Type.Kill;
     k.target = target;
     character.AddCommand (k);
     return k;
 }
Example #2
0
    // Todo, create a "Basic command", which just fills out the command informtion with basic data.
    public static Command MoveCommand( Vector3 start, Vector3 end, CharacterAI character )
    {
        Command c = Command.CreateInstance<Command> ();
        c.name = "Move: " + end.ToString ();
        float d = Vector3.Distance (start, end);
        c.time = d / character.character.speed;
        c.position = end;
        c.type = Type.Move;
        character.AddCommand (c);

        return c;
    }
Example #3
0
    public static Command InteractCommand(Transform target, CharacterAI character, string interactCommand, float interactRange = 5f)
    {
        Command i = Command.CreateInstance<Command> ();
        i.metadata = interactCommand;

        i.name = "Interact: " + target.name + " with " + interactCommand;
        i.time = Vector3.Distance (character.transform.position, target.position) / character.character.speed;
        i.position = target.position;
        i.type = Type.Interact;
        i.target = target;
        i.attributes.AddAttribute ("InteractRange", interactRange);

        character.AddCommand (i);
        return i;
    }