Ejemplo n.º 1
0
        public Actor(String id, String asset_name, Vector2 starting, Stage Parent)  // Basic constructor.
        {
            this.objectId = IdFactory.GetNextId();
            asset_Name    = asset_name;
            speed         = 100;
            Location      = new Vector3(starting.X, starting.Y, 0);

            parent = Parent;
            name   = id;
            learnAction(new Actionstate("Talking"));
            learnAction(new Stand());
            learnAction(new Walk());
            learnAction(new Limp());
            learnAction(new Jump());
            learnAction(new Run());
            learnAction(new UseItem());
            learnAction(new Dead());
            learnAction(new Unconcious());
            learnAction(new FallForward());
            learnAction(new StandUp());
            learnAction(new Prone());
            learnAction(new Rest());

            defaultAction = knownActions["Standing"];
            SetAction("Standing");
        }
Ejemplo n.º 2
0
        public override void ApplyAction(Actionstate affected, Actor affector)
        {
            switch (affected.ID)
            {
            case "Talking":
                break;

            case "UseItem":

                if (parent.player.CurrentItem.HasProperty("Fire"))
                {
                    current_Action = burning;
                    parent.addLight(onFire);
                    parent.AM.InstantiateEffect("fire", this, true);
                }
                if (parent.player.CurrentItem.HasProperty("Water") && current_Action.id == "Burning")
                {
                    SetAction("Standing"); parent.removeLight(onFire);
                }

                break;


            case "Nothing":
                break;

            default:
                break;
            }
        }
Ejemplo n.º 3
0
        public virtual void FinishLoad(GameManager manager)
        {
            this.gameManager = manager;

            learnAction(new Actionstate("Talking"));
            learnAction(new Actionstate("Standing"));
            learnAction(new Jump());
            learnAction(new UseItem());
            learnAction(new Walk());

            defaultAction = knownActions["Standing"];
            SetAction("Standing");
        }
Ejemplo n.º 4
0
 public virtual void SetAction(String nextAction, int frame)
 {
     if (nextAction == "Walking" || nextAction == "Running")
     {
         current_Action = knownActions[movement(nextAction)];
         //  current_Action.Reset();
     }
     else if (knownActions.ContainsKey(nextAction))
     {
         current_Action       = knownActions[nextAction];
         current_Action.Frame = frame;
     }
 }
Ejemplo n.º 5
0
        public virtual void ApplyAction(Actionstate affected, Actor affector)
        {
            switch (affected.ID)
            {
            case "Interact":

                break;

            case "Nothing":
                break;

            default:
                break;
            }
        }
Ejemplo n.º 6
0
        public virtual void ApplyAction(Actionstate affected, Actor affector)
        {
            switch (affected.ID)
            {
            case "Interact":
                // affector.Inventory.AddItem(this);
                break;

            case "UseItem":
                break;

            case "Nothing":
                break;

            default:
                break;
            }
        }
Ejemplo n.º 7
0
        public override void ApplyAction(Actionstate affected, Actor affector)
        {
            switch (affected.ID)
            {
            case "Interact":
                break;

            case "UseItem":

                break;


            case "Nothing":
                break;

            default:
                break;
            }
        }
Ejemplo n.º 8
0
 public virtual void SetAction(String nextAction)
 {
     if (current_Action == null)
     {
         current_Action = knownActions[nextAction];
     }
     if (nextAction != null && nextAction != current_Action.ID)
     {
         if (nextAction == "Walking" || nextAction == "Running")
         {
             current_Action = knownActions[movement(nextAction)];
             //  current_Action.Reset();
         }
         else if (knownActions.ContainsKey(nextAction))
         {
             current_Action = knownActions[nextAction];
             current_Action.Reset();
         }
     }
 }
Ejemplo n.º 9
0
 public void DefaultAction()
 {
     current_Action = defaultAction;
 }
Ejemplo n.º 10
0
 public void Talking()
 {
     current_Action = talking;
 }
Ejemplo n.º 11
0
 protected virtual void learnAction(Actionstate learned)
 {
     knownActions.Add(learned.id, learned); learned.Actor = this;
 }