Пример #1
0
        public void OnCollisionEnter(Collider other)
        {
            if (other.GameObject.GetComponent("Player") != null)
            {
                SpriteRenderer spriteRenderer = (SpriteRenderer)GameObject.GetComponent("SpriteRenderer");
                color = Color.Red;
                spriteRenderer.Color = color;

                int j = GameWorld.GameObjects.Count;
                for (int i = 0; i < j; i++)
                {
                    GameObject go = GameWorld.GameObjects[i];
                   
                    if (go.GetComponent("Door") != null)
                    {

                        Door localDoor = (Door)go.GetComponent("Door");
                        if (localDoor.Name == name)
                        {
                            GameWorld.Instance.RemoveGameObjects.Add(go);
                        }
                        
                    }
                }
               
              

            }
            
        }
Пример #2
0
 public void OnCollisionExit(Collider other)
 {
     if (other.GameObject.GetComponent("MoveableBox") != null)
     {
         SpriteRenderer spriteRenderer = (SpriteRenderer)GameObject.GetComponent("SpriteRenderer");
         color = Color.Red;
         spriteRenderer.Color = color;
     }
 }
Пример #3
0
        public void OnCollisionEnter(Collider other)
        {
            if(other.GameObject.GetComponent("Player") != null)
            {
                if (GameWorld.Instance.Level == "level 2")
                {

                    GameWorld.Instance.Completed = true;
                    GameWorld.Instance.Level = "level 3";
                }
                if (GameWorld.Instance.Level == "level 1")
                {

                    GameWorld.Instance.Completed = true;
                    GameWorld.Instance.Level = "level 2";
                }
            }
        }
Пример #4
0
        public void OnCollisionEnter(Collider other)
        {
            if (other.GameObject.GetComponent("Player") == null && other.GameObject.GetComponent("Gift") == null && other.GameObject.GetComponent("BoxPreassurePlate") == null && other.GameObject.GetComponent("PreassurePlate") == null)
            {

                strategy = new Idle(animator, transform);
                strategy.Update(ref playerDirection);
                player.OnCollisionEnter(other);
            }            
            else if (other.GameObject.GetComponent("Player") != null)
            {
                player = (Player)other.GameObject.GetComponent("Player");
                playerDirection = player.Direction;
                strategy = new MoveBox(animator, transform);
                strategy.Update(ref playerDirection);
                
            }

        }
Пример #5
0
 public void OnCollisionExit(Collider other)
 {
    // Debug.Write("exit gift/level");
 }
Пример #6
0
 public void OnCollisionExit(Collider other)
 {
     strategy = new Idle(animator, transform);
 }
Пример #7
0
        public void OnCollisionExit(Collider other)
        {

        }
Пример #8
0
        public void OnCollisionEnter(Collider other)
        {
            if (other.GameObject.GetComponent("PreassurePlate") != null)
            {

            } else if (other.GameObject.GetComponent("MoveableBox") != null)
            {

            }
            else if(other.GameObject.GetComponent("BoxPreassurePlate") != null)
            {

            }
            else if (other.GameObject.GetComponent("Gift") != null)
            {

            }
            if(other.GameObject.GetComponent("Gift") == null && other.GameObject.GetComponent("BoxPreassurePlate") == null && other.GameObject.GetComponent("PreassurePlate") == null && other.GameObject.GetComponent("MoveableBox") == null)
            {
                if (direction == Direction.Front)
                {
                    oppositeDirection = Direction.Back;
                }
                else if (direction == Direction.Back)
                {
                    oppositeDirection = Direction.Front;
                }
                else if (direction == Direction.Right)
                {
                    oppositeDirection = Direction.Left;
                }
                else if (direction == Direction.Left)
                {
                    oppositeDirection = Direction.Right;
                }
                strategy.Update(ref oppositeDirection);
            }
            
        }