コード例 #1
0
ファイル: GameObject.cs プロジェクト: Orujimaru/Orujin2
 public bool PartlyEquals(Identity other)
 {
     if (name.Equals(other.name) || tag.Equals(other.tag))
     {
         return true;
     }
     return false;
 }
コード例 #2
0
ファイル: GameObject.cs プロジェクト: Orujimaru/Orujin2
 public bool Equals(Identity other)
 {
     if (name.Equals(other.name) && tag.Equals(other.tag))
     {
         return true;
     }
     return false;
 }
コード例 #3
0
ファイル: MyGameClass.cs プロジェクト: Orujimaru/Orujin
        private void CreateCameraEventsAndBorders(Identity identity)
        {
            //Right side
            List<GameEventCommand> rightBorderEventCommands = new List<GameEventCommand>();
            rightBorderEventCommands.Add(new GameEventCommand("Game", null, "PauseLogic", DynamicArray.ObjectArray(1), 0));
            rightBorderEventCommands.Add(new GameEventCommand("Camera", null, "MoveBy", DynamicArray.ObjectArray(new Vector2(1280.0f, 0), 2000), 0));
            rightBorderEventCommands.Add(new GameEventCommand("Game", null, "ResumeLogic", DynamicArray.ObjectArray(1), 2000));
            GameEvent rightBorderEvent = new GameEvent(rightBorderEventCommands);

            Trigger rightCameraBorder = new Trigger(new Vector2(1330, 400), new Rectangle(0, 0, 50, 2000), "Right Camera Object", GameEventCondition.RightCameraBorderId, identity, this.world, 0, true);

            GameEventCondition rightCameraBorderCondition = new GameEventCondition(GameEventCondition.RightCameraBorderId, rightBorderEvent);
            base.AddEventCondition(rightCameraBorderCondition);

            //Left side
            List<GameEventCommand> leftBorderEventCommands = new List<GameEventCommand>();
            leftBorderEventCommands.Add(new GameEventCommand("Game", null, "PauseLogic", DynamicArray.ObjectArray(1), 0));
            leftBorderEventCommands.Add(new GameEventCommand("Camera", null, "MoveBy", DynamicArray.ObjectArray(new Vector2(-1280.0f, 0), 2000), 0));
            leftBorderEventCommands.Add(new GameEventCommand("Game", null, "ResumeLogic", DynamicArray.ObjectArray(1), 2000));
            GameEvent leftBorderEvent = new GameEvent(leftBorderEventCommands);

            Trigger leftCameraBorder = new Trigger(new Vector2(-50, 400), new Rectangle(0, 0, 50, 2000), "Left Camera Object", GameEventCondition.LeftCameraBorderId, identity, this.world, 0, true);

            GameEventCondition leftCameraBorderCondition = new GameEventCondition(GameEventCondition.LeftCameraBorderId, leftBorderEvent);
            base.AddEventCondition(leftCameraBorderCondition);

            //Unlock Horizontally
            GameEvent unlockCameraHorizontallyEvent = new GameEvent(new GameEventCommand("Camera", null, "UnlockHorizontally", DynamicArray.ObjectArray(50), 0));
            GameEventCondition unlockCameraHorizontallyCondition = new GameEventCondition(GameEventCondition.UnlockCameraHorizontallyId, unlockCameraHorizontallyEvent);
            base.AddEventCondition(unlockCameraHorizontallyCondition);

            //Lock Horizontally
            GameEvent lockCameraHorizontallyEvent = new GameEvent(new GameEventCommand("Camera", null, "LockHorizontally", DynamicArray.ObjectArray(1), 0));
            GameEventCondition lockCameraHorizontallyCondition = new GameEventCondition(GameEventCondition.LockCameraHorizontallyId, lockCameraHorizontallyEvent);
            base.AddEventCondition(lockCameraHorizontallyCondition);

            //Unlock Vertically
            GameEvent unlockCameraVerticallyEvent = new GameEvent(new GameEventCommand("Camera", null, "UnlockVertically", DynamicArray.ObjectArray(50), 0));
            GameEventCondition unlockCameraVerticallyCondition = new GameEventCondition(GameEventCondition.UnlockCameraVerticallyId, unlockCameraVerticallyEvent);
            base.AddEventCondition(unlockCameraVerticallyCondition);

            //Lock Vertically
            GameEvent lockCameraVerticallyEvent = new GameEvent(new GameEventCommand("Camera", null, "LockVertically", DynamicArray.ObjectArray(1), 0));
            GameEventCondition lockCameraVerticallyCondition = new GameEventCondition(GameEventCondition.LockCameraVerticallyId, lockCameraVerticallyEvent);
            base.AddEventCondition(lockCameraVerticallyCondition);

            //Test unlocker
            //CameraObject co = new CameraObject(1280, 2, new Vector2(640, 300), CameraObject.UnlockWhenPlayerMovesRight, "TestCameraObject");
        }
コード例 #4
0
ファイル: GameObject.cs プロジェクト: Orujimaru/Orujin2
        public GameObject(Vector2 position, string name, string tag)
        {
            this.initialPosition = position;
            this.position = position;
            this.previousPosition = position;
            this.nextVelocity = Vector2.Zero;
            this.velocityModifier = 0.2f;
            this.rendererComponents = new RendererComponents(this);

            Identity identity = new Identity();
            identity.name = name;
            identity.tag = tag;
            this.identity = identity;
            this.constant = false;
            idGen += 1;
            this.id = idGen;
        }
コード例 #5
0
ファイル: Trigger.cs プロジェクト: Orujimaru/Orujin
 public Trigger(Vector2 position, Rectangle rectangle, string name, int conditionId, Identity triggerer, World world, int maxTriggerCount, bool constant)
     : base(position, name, "Trigger")
 {
     Body body = BodyFactory.CreateRectangle(world, rectangle.Width / Camera.PixelsPerMeter, rectangle.Height / Camera.PixelsPerMeter, 1);
     body.BodyType = BodyType.Static;
     body.IsSensor = true;
     base.AddBody(body);
     this.triggerer = triggerer;
     this.triggered = false;
     this.conditionId = conditionId;
     this.consumed = false;
     this.maxTriggerCount = maxTriggerCount;
     this.currentTriggerCount = 0;
     if (constant)
     {
         this.SetConstant();
     }
     GameManager.game.AddObject(this);
 }