public void CF_Action_AttachKeyToActor(PMGActor actor, PMGValueStack localStack)
            {
                //disables/removes other events and adds parrents this actor under the other, or follows it constantly 

                //add key to players "inventory"
                if (localStack.GetActor().HasKey == false)
                {
                    localStack.GetActor().HasKey = true;
                    //Debug.Log("got the key");


                    /*GameObject Anchor = GameObject.Find("ActorAnchor");
                    //if()
                    GameObject talk = Instantiate(Resources.Load("Prefabs/TalkBlock"), SingleMapManager.Instance.GameMap[actor.position[0], actor.position[1]].transform.position + new Vector3(2f, 2f, -1), Quaternion.identity) as GameObject;
                    talk.transform.eulerAngles = SingleMenuManager.Instance.LeRotation();
                    talk.GetComponent<Renderer>().material.mainTexture = (Texture2D)Resources.Load("Textures/GettingKey") as Texture2D;
                    talk.transform.parent = Anchor.transform;
                    talk.name = "Here have the key";//*/
                }
                


                //turn display off maybe
                //SingleInstanceManager.Instance.unityActors
            }
            public override bool Do(PMGActor actor, PMGValueStack localStack)
            {
                // call correct change function
                actor.Core.ChangeFunctions.Collection[_whichFunction](actor, localStack);

                //dummy return that's not used
                return(true);
            }
            /*
             * USER DEFINED FUNCTIONS
             */
            public void VF_DebugWriteToConsole(PMGActor actor, PMGValueStack localStack)
            {
                // Write a message to console for testing purposes.
                System.Console.WriteLine("VF_DebugWriteToConsole Called!");

                // You can also call other functions!
                VF_Push1337ToLocal(actor, localStack);
            }
            public bool CF_CheckStats_ActorHasMaxKeys(PMGActor actor, PMGValueStack localStack)
            {
                if (localStack.GetActor().HasKey)
                {
                    return(true);
                }

                return(false);
            }
            /*
             * USER DEFINED FUNCTIONS
             */
            public void CF_DebugWriteToConsole(PMGActor actor, PMGValueStack localStack)
            {
                // Write a message to console for testing purposes.
                int fromStack = System.Convert.ToInt32(localStack.PopValueOfType(ValueType.INT));

                string s = string.Format("Change function called. Got {0} from stack!", fromStack);

                Console.WriteLine(s);
            }
Exemplo n.º 6
0
            public PMGEvent(PMGMethod method, PMGActor calling,
                            EventTriggerBehavior behavior = EventTriggerBehavior.ALWAYS)
            {
                _method       = method;
                _behavior     = behavior;
                _callingActor = calling;

                _hasBeenFalse  = false;
                _methodRunning = false;
            }
            public PMGActor PopActor()
            {
                PMGActor tA = PopValueOfType(ValueType.ACTOR) as PMGActor;

                if (tA == null)
                {
                    throw new System.InvalidCastException("Getting actor value and casting as actor failed and returned null.");
                }

                return(tA);
            }
Exemplo n.º 8
0
 public bool CF_Input_IsLeftPressedOnce(PMGActor actor, PMGValueStack localStack)
 {
     Console.WriteLine("     key left is pressed");
     //return true;
     if ((Input.GetKeyDown(KeyCode.A) && !leftPressed) || (Input.GetKeyDown(KeyCode.LeftArrow) && !leftPressed))
     {
         leftPressed = true;
         return(true);
     }
     leftPressed = false;
     return(false);
 }
Exemplo n.º 9
0
 public bool CF_Input_IsDownPressedOnce(PMGActor actor, PMGValueStack localStack)
 {
     Console.WriteLine("     key down is pressed");
     //return true;
     if ((Input.GetKeyDown(KeyCode.S) && !downPressed) || (Input.GetKeyDown(KeyCode.DownArrow) && !downPressed))
     {
         downPressed = true;
         return(true);
     }
     downPressed = false;
     return(false);//*/
 }
Exemplo n.º 10
0
 public bool CF_Input_IsRightPressedOnce(PMGActor actor, PMGValueStack localStack)
 {
     Console.WriteLine("     key right is  pressed");
     //return true;
     if ((Input.GetKeyDown(KeyCode.D) && !rightPressed) || (Input.GetKeyDown(KeyCode.RightArrow) && !rightPressed))
     {
         rightPressed = true;
         return(true);
     }
     rightPressed = false;
     return(false);
 }
Exemplo n.º 11
0
            public bool CF_Input_IsActionPressedOnce(PMGActor actor, PMGValueStack localStack)
            {
                Console.WriteLine("     key action is pressed");
                //return true;

                if ((Input.GetKeyDown(KeyCode.Return) && !actionPressed) || (Input.GetKeyDown(KeyCode.Space) && !actionPressed))
                {
                    actionPressed = true;
                    return(true);
                }
                actionPressed = false;
                return(false);  //*/
            }
 public bool CF_Dectection_IsDownAWall(PMGActor actor, PMGValueStack localStack)
 {
     if (Map.chart[actor.position[0], actor.position[1] + 1] == 1)
     {
         //Console.WriteLine("     down is a wall");
         return(true);
     }
     else
     {
         //Console.WriteLine("     down is a space");
         return(false);
     }
 }
 public bool CF_Dectection_IsRightAWall(PMGActor actor, PMGValueStack localStack)
 {
     if (Map.chart[actor.position[0] + 1, actor.position[1]] == 1)
     {
         //Console.WriteLine("     right is a Wall");
         return(true);
     }
     else
     {
         //Console.WriteLine("     right is a space");
         return(false);
     }
 }
Exemplo n.º 14
0
            public bool CF_Input_IsUpPressedOnce(PMGActor actor, PMGValueStack localStack)
            {
                Console.WriteLine("     key up is pressed");

                //return true;
                if ((Input.GetKeyDown(KeyCode.W) && !upPressed) || (Input.GetKeyDown(KeyCode.UpArrow) && !upPressed))
                {
                    upPressed = true;
                    return(true);
                }
                upPressed = false;
                return(false);//
            }
 public bool CF_Dectection_IsLeftASpace(PMGActor actor, PMGValueStack localStack)
 {
     if (Map.chart[actor.position[0] - 1, actor.position[1]] == 0)
     {
         //Console.WriteLine("     left is a space");
         return(true);
     }
     else
     {
         //Console.WriteLine("     left is a wall");
         return(false);
     }
 }
Exemplo n.º 16
0
            public PMGExecuteList(object owner, FunctionOwnerType ownerT, PMGActor actor)
            {
                // The owner of the execution list (event or method)
                if (owner == null)
                {
                    throw new System.ArgumentNullException("owner");
                }
                _owner     = owner;
                _ownerType = ownerT;

                // The actor that owns the owner (yaya too meta shut up)
                _actor = actor;
            }
Exemplo n.º 17
0
 public void CF_Movement_MoveDownOnce(PMGActor actor, PMGValueStack localStack)
 {
     //map boundary check
     if (actor.position[1] + 1 < Map.chart.GetLength(1))
     {
         actor.position[1] = actor.position[1] + 1;
         Console.WriteLine("         moved down 1 step");
     }
     else
     {
         Console.WriteLine("         cant moved down 1 step");
     }
 }
            public bool CF_Collision_WithActorType_0(PMGActor actor, PMGValueStack localStack)
            {
                //hack job stuff
                if (actor.position[0] == localStack.ActorStack.Values[0].position[0] && actor.position[1] == localStack.ActorStack.Values[0].position[1])
                {
                    //Debug.Log("colliding with player");
                    return(true);
                }


                //Debug.Log("'player' 's pos: "+ localStack.GetActor().position[0]+","+localStack.GetActor().position[1]);
                //Debug.Log("'enemy' 's pos: "+ actor.position[0]+","+actor.position[1]);
                return(false);
            }
Exemplo n.º 19
0
 public void VF_PushToStack_ActorType_0(PMGActor actor, PMGValueStack localStack)
 {
     //hack job stuff
     for (int i = 0; i < actor.Core.WorldActors.Count; i++)
     {
         //checks for type 0 aka the player
         if (actor.Core.WorldActors[i].Type == 0)
         {
             //adds the player to the local stack
             localStack.Push(actor.Core.WorldActors[i]);
             //Debug.Log("actor: "+ actor.Core.WorldActors[i]+" has positionx: "+ actor.Core.WorldActors[i].position[0]);
         }
     }
 }
Exemplo n.º 20
0
 public void CF_Movement_MoveRightOnce(PMGActor actor, PMGValueStack localStack)
 {
     //map boundary check
     if (actor.position[0] + 1 < Map.chart.GetLength(0))
     {
         actor.position[0] = actor.position[0] + 1;
         Console.WriteLine("         moved right 1 step");
         Debug.Log("moved one step right");
     }
     else
     {
         Console.WriteLine("         cant moved right 1 step");
     }
 }
 /*
  * USER DEFINED FUNCTIONS
  */
 public bool CF_DebugWriteToConsole(PMGActor actor, PMGValueStack localStack)
 {
     //System.Console.WriteLine("Cond. function checking if timestep > 5");
     if (actor.Core.WorldTimeSteps > 5)
     {
         //Console.WriteLine("It did!");
         return(true);
     }
     else
     {
         //Console.WriteLine("It did not!");
         return(false);
     }
 }
Exemplo n.º 22
0
 public void CF_Movement_MoveLeftOnce(PMGActor actor, PMGValueStack localStack)
 {
     //x
     //map boundary check
     if (actor.position[0] - 1 > 0)
     {
         actor.position[0] = actor.position[0] - 1;
         Console.WriteLine("         moved left 1 step");
     }
     else
     {
         Console.WriteLine("         cant moved left 1 step");
     }
 }
            public bool CF_Collision_WithActorType_0_1(PMGActor actor, PMGValueStack localStack)
            {
                for (int i = 0; i < localStack.ActorStack.Values.Count; i++)
                {
                    //hack job stuff
                    if (actor.position[0] == localStack.ActorStack.Values[i].position[0] && actor.position[1] == localStack.ActorStack.Values[i].position[1])
                    {
                        return(true);
                    }
                }

                //Debug.Log("'player' 's pos: "+ localStack.GetActor().position[0]+","+localStack.GetActor().position[1]);
                //Debug.Log("'enemy' 's pos: "+ actor.position[0]+","+actor.position[1]);
                return(false);
            }
Exemplo n.º 24
0
            public void CF_Movement_MoveUpOnce(PMGActor actor, PMGValueStack localStack)
            {
                //y

                //map boundary check
                if (actor.position[1] - 1 > 0)
                {
                    actor.position[1] = actor.position[1] - 1;
                    Console.WriteLine("         moved up 1 step");
                    Debug.Log("moved one step up");
                }
                else
                {
                    Console.WriteLine("         cant moved up 1 step");
                }
            }
 public void CF_Movement_MoveRightOnce(PMGActor actor, PMGValueStack localStack)
 {
     //map boundary check
     if (actor.position[0] + 1 < Map.chart.GetLength(0) && !actor.HasMoved)
     {
         actor.position[0] = actor.position[0] + 1;
         //Console.WriteLine("         moved right 1 step");
         //Debug.Log("Actor: " + actor.Type + " moved one step right");
         actor.HasMoved = true;
     }
     else
     {
         //Console.WriteLine("         cant moved right 1 step");
         //Debug.Log("Cant move right");
     }
 }            
Exemplo n.º 26
0
            public bool CF_Input_IsRightPressedOnce(PMGActor actor, PMGValueStack localStack)
            {
                Console.WriteLine("     key right is  pressed");
                return(true);

                if ((Keyboard.IsKeyDown(Key.D) && !rightPressed) || (Keyboard.IsKeyDown(Key.Right) && !rightPressed))
                {
                    rightPressed = true;
                    return(true);
                }
                if (Keyboard.IsKeyUp(Key.D) && Keyboard.IsKeyUp(Key.Right) && rightPressed)
                {
                    rightPressed = false;
                }
                return(false);
            }
Exemplo n.º 27
0
            public bool CF_Input_IsActionPressedOnce(PMGActor actor, PMGValueStack localStack)
            {
                Console.WriteLine("     key action is pressed");
                return(true);

                if ((Keyboard.IsKeyDown(Key.Return) && !actionPressed) || (Keyboard.IsKeyDown(Key.Space) && !actionPressed))
                {
                    actionPressed = true;
                    return(true);
                }
                if (Keyboard.IsKeyUp(Key.Return) && Keyboard.IsKeyUp(Key.Space) && actionPressed)
                {
                    actionPressed = false;
                }
                return(false);  //*/
            }
Exemplo n.º 28
0
            public bool CF_Input_IsLeftPressedOnce(PMGActor actor, PMGValueStack localStack)
            {
                Console.WriteLine("     key left is pressed");
                return(true);

                if ((Keyboard.IsKeyDown(Key.A) && !leftPressed) || (Keyboard.IsKeyDown(Key.Left) && !leftPressed))
                {
                    leftPressed = true;
                    return(true);
                }
                if (Keyboard.IsKeyUp(Key.A) && Keyboard.IsKeyUp(Key.Left) && leftPressed)
                {
                    leftPressed = false;
                }
                return(false);
            }
 public void CF_Movement_MoveLeftOnce(PMGActor actor, PMGValueStack localStack)
 {                
     //map boundary check
     if (actor.position[0] - 1 > 0 && !actor.HasMoved)
     {
         actor.position[0] = actor.position[0] - 1;
         //Console.WriteLine("         moved left 1 step");
         //Debug.Log("Actor: " + actor.Type + " moved one step left");
         actor.HasMoved = true;
     }
     else
     {
         //Console.WriteLine("         cant moved left 1 step");
         //Debug.Log("Cant move left");
     }
 }
Exemplo n.º 30
0
            public bool CF_Input_IsUpPressedOnce(PMGActor actor, PMGValueStack localStack)
            {
                Console.WriteLine("     key up is pressed");

                return(true);

                if ((Keyboard.IsKeyDown(Key.W) && !upPressed) || (Keyboard.IsKeyDown(Key.Up) && !upPressed))
                {
                    upPressed = true;
                    return(true);
                }
                if (Keyboard.IsKeyUp(Key.W) && Keyboard.IsKeyUp(Key.Up) && upPressed)
                {
                    upPressed = false;
                }
                return(false);//
            }