Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        protected override void DefineStaticObjects()
        {
            Lights ll = new Lights();

            ll.TurnOff();
            this.PlaceObjectTo(new int2(5, 5), ll);

            /*
             * Lights lll = new Lights();
             * lll.TurnOff();
             * this.PlaceObjectTo(new int2(2, 5), lll);
             *
             * Lights llll = new Lights();
             * llll.TurnOff();
             * this.PlaceObjectTo(new int2(2, 2), llll);
             *
             */
            LightsControl lc = new LightsControl();

            lc.TurnOff();
            lc.myObjects.Add(ll);
            this.PlaceObjectTo(new int2(1, 1), lc);

            MyDoor door2 = new MyDoor();

            door2.TurnOff();
            this.PlaceObjectTo(new int2(5, 1), door2);

            DoorControl dc = new DoorControl();

            dc.myObjects.Add(door2);
            this.PlaceObjectTo(new int2(1, 5), dc);

            StaticObjects = new MyStaticObject[] { ll, lc, door2, dc };//,lll,llll};
        }
Ejemplo n.º 2
0
    public void FinishedPlayInRoom()
    {
        foreach (vertex door in OpenedDoors)
        {
            DoorControl dc = door.gameObject.GetComponent <DoorControl>();
            dc.OpenTheDoor();
        }
        isPlayingInRoom = false;

        if (status == RoomStatus.bossRoom)
        {
            randomFrom.WrapGateToTheNextLevel.gameObject.transform.position = new Vector3(
                transform.position.x - 2.5f,
                transform.position.y,
                transform.position.z - 2.5f
                );

            randomFrom.WrapGateToTheNextLevel.gameObject.SetActive(true);
            GameManagerPC.Instance.TriggerWhenStateClear();
        }


        afterFinisedRoom.Invoke();
        status = RoomStatus.clearedRoom;
        allEnemyInRoom.Clear();
        // if(randomFrom.OnAllRoomClear()){
        //     randomFrom.WrapGateToTheNextLevel.gameObject.SetActive(true);
        //     randomFrom.WrapGateToTheNextLevel.gameObject.transform.position = transform.position;
        // }
    }
Ejemplo n.º 3
0
/*
 * Opens the door that is in the targeted tile.
 */

    public override void ExecuteTrap(int triggerX, int triggerY, int State)
    {
        GameObject door = GameWorldController.findDoor(triggerX, triggerY);

        if (door != null)
        {
            DoorControl DC = door.GetComponent <DoorControl>();

            switch (objInt.Quality)
            {
            case 1:            //try open
                DC.UnlockDoor();
                DC.OpenDoor();
                break;

            case 2:            //try close
                DC.CloseDoor();
                DC.LockDoor();
                break;

            case 3:            //try toggle
                //TODO:check if toggle respects unlocked status. (door trap 1001 on level 3)
                DC.ToggleDoor();
                break;
            }
        }
        else
        {
            Debug.Log("Door not found!");
        }
    }
Ejemplo n.º 4
0
    public override void    execute()
    {
        this.door = null;

        // 파워업 타이머
        // (캔디를 획득했을 때).
        if (this.shot_boost_timer > 0.0f)
        {
            this.shot_boost_timer -= Time.deltaTime;

            if (this.shot_boost_timer <= 0.0f)
            {
                // 타임아웃으로 효과 끝남.

                this.shot_boost_timer = 0.0f;

                ItemWindow.get().clearItem(Item.SLOT_TYPE.CANDY, 0);

                this.item_slot.candy.initialize();
            }
        }

        this.melee_attack.execute();

        if (this.ice_timer >= 0.0f)
        {
            this.ice_timer -= Time.deltaTime;
        }

        this.executeJinJin();

        this.skin_color_control.execute();

        this.execute_queries();
    }
Ejemplo n.º 5
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.name.Contains("Door"))
     {
         _doorInstance = coll.gameObject.GetComponent <DoorControl>();
     }
 }
Ejemplo n.º 6
0
    public void OnConsumedKey(string key_type)
    {
        //Debug.Log ("consumed key --- " + type);

        DoorControl door = null;

        do
        {
            // 열쇠에 대응하는 문을 찾는다.

            Item.KEY_COLOR key_color = Item.Key.getColorFromTypeName(key_type);

            if (key_color == Item.KEY_COLOR.NONE)
            {
                break;
            }

            door = this.doors.Find(x => x.KeyType == (int)key_color);

            if (door == null)
            {
                break;
            }

            // 언락.
            door.Unlock();

            // 연결된 문도 언락.
            if (door.connect_to != null)
            {
                door.connect_to.Unlock();
            }
        } while(false);
    }
Ejemplo n.º 7
0
    void OnTriggerEnter(Collider other)
    {
        // When walking through a door
        if (other.gameObject.CompareTag("Door"))
        {
            DoorControl doorMono = other.gameObject.GetComponent <DoorControl>();

            Vector3 goalPos = doorMono.goalDoor.transform.position + doorMono.goalDoor.transform.forward * DOOR_JUMP;
            goalPos.y = 0;

            doorMono.goalDoor.GetComponent <DoorControl>().EnterRoom();

            // Move the character to the room linked to the door they went through
            this.transform.position = goalPos;

            // Make the camera follow the characters position
            mainCameraTransform.position = (doorMono.goalDoor.GetComponent <DoorControl>().ownRoom.transform.position) + cameraPosition;

            // Updates the room references to the new room
            doorMono.ExitRoom();
            currentRoom = doorMono.goalDoor.GetComponent <DoorControl>().ownRoom;
            AchievementManager.Instance.enterRoom(currentRoom);
        }
        // Tracks webs the player is currently stepping on
        else if (other.gameObject.CompareTag("Web"))
        {
            inWeb++;
        }
    }
        public void SetUp()
        {
            _FakeDoor           = Substitute.For <IDoor>();
            _FakeUserValidation = Substitute.For <IUserValidation>();

            _uut = new DoorControl(_FakeDoor, _FakeUserValidation);
        }
Ejemplo n.º 9
0
 public void Setup()
 {
     _fakeDoor           = Substitute.For <IDoor>();
     _fakeNotification   = Substitute.For <IEntryNotification>();
     _fakeUserValidation = Substitute.For <IUserValidation>();
     _doorControl        = new DoorControl(_fakeDoor, _fakeUserValidation, _fakeNotification);
 }
Ejemplo n.º 10
0
        protected override void DefineStaticObjects()
        {
            Lights ll = new Lights();

            ll.TurnOn();
            this.PlaceObjectTo(new int2(6, 0), ll);

            LightsControl lc = new LightsControl();

            lc.myObjects.Add(ll);
            lc.TurnOn();
            this.PlaceObjectTo(new int2(1, 1), lc);

            // lights control
            Lights llX = new Lights();

            llX.TurnOn();
            this.PlaceObjectTo(new int2(6, 9), llX);

            LightsControl lcX = new LightsControl();

            lcX.myObjects.Add(llX);
            lcX.TurnOn();
            this.PlaceObjectTo(new int2(9, 9), lcX);

            // place into the map
            MyDoor doorX = new MyDoor();

            doorX.TurnOff();
            this.PlaceObjectTo(new int2(8, 6), doorX);

            DoorControl doorControlX = new DoorControl();

            doorControlX.myObjects.Add(doorX);
            doorControlX.TurnOff();
            this.PlaceObjectTo(new int2(4, 7), doorControlX);

            // door 2 with two controls
            MyDoor door2 = new MyDoor();

            door2.TurnOff();
            this.PlaceObjectTo(new int2(5, 5), door2);

            DoorControl dc = new DoorControl();

            //dc.myObjects.Add(door);
            dc.myObjects.Add(door2);
            dc.TurnOff();
            this.PlaceObjectTo(new int2(1, 8), dc);

            DoorControl dc2 = new DoorControl();

            //dc2.myObjects.Add(door);
            dc2.myObjects.Add(door2);
            dc2.TurnOff();
            this.PlaceObjectTo(new int2(8, 1), dc2);

            StaticObjects = new MyStaticObject[] { dc, dc2, door2, doorX, doorControlX, lcX, llX, ll, lc };
        }
Ejemplo n.º 11
0
        public void Setup()
        {
            _entryNotification = Substitute.For <IEntryNotifcation>();
            _userValidation    = Substitute.For <IUserValidation>();
            _doors             = Substitute.For <IDoors>();

            _uut = new DoorControl(_doors, _entryNotification, _userValidation);
        }
Ejemplo n.º 12
0
 public void Setup()
 {
     _alarm             = Substitute.For <IAlarm>();
     _door              = Substitute.For <IDoor>();
     _entryNotification = Substitute.For <IEntryNotification>();
     _userValidation    = Substitute.For <IUserValidation>();
     _uut = new DoorControl(_door, _userValidation, _entryNotification, _alarm);
 }
Ejemplo n.º 13
0
 void Start()
 {
     ClosedPositionY = transform.localPosition.y;
     controller = GetComponent<DoorControl> ();
     if (controller != null) {
         controller.OnActivate += HandleOnActivate;
     }
 }
Ejemplo n.º 14
0
 private void activateDoors()
 {
     foreach (GameObject door in doors)
     {
         DoorControl doorController = door.GetComponent <DoorControl>();
         doorController.activateDoor();
     }
 }
 public void SetUp()
 {
     _doorFake              = Substitute.For <IDoor>();
     _alarmFake             = Substitute.For <IAlarm>();
     _entryNotificationFake = Substitute.For <IEntryNotification>();
     _userValidationFake    = Substitute.For <IUserValidation>();
     _uut = new DoorControl(_doorFake, _alarmFake, _entryNotificationFake, _userValidationFake);
 }
Ejemplo n.º 16
0
        public void SetUp()
        {
            _door              = new MockDoor();
            _userValidation    = new MockUserValidation();
            _entryNotification = new MockEntryNotification();
            _alarm             = new MockAlarm();

            _uut = new DoorControl(_door, _userValidation, _entryNotification, _alarm);
        }
 public void Setup()
 {
     _alarm             = Substitute.For <IAlarm>();
     _door              = Substitute.For <IDoor>();
     _userValidation    = Substitute.For <IUserValidation>();
     _entryNotification = Substitute.For <IEntryNotification>();
     _uut = new DoorControl(_userValidation, _door, _entryNotification, _alarm);
     _userValidation.ValidateEntryRequest("TFJ").Returns(true);
 }
Ejemplo n.º 18
0
    void OnTriggerExit(Collider other)
    {
        DoorControl door = device.GetComponent <DoorControl> ();

        if (door != null)
        {
            door.Operate();
        }
    }
Ejemplo n.º 19
0
        public void Setup()
        {
            alarm         = Substitute.For <IAlarm>();
            door          = Substitute.For <IDoor>();
            entryNot      = Substitute.For <IEntryNotification>();
            userValidator = Substitute.For <IUserValidation>();

            uut = new DoorControl(door, alarm, userValidator, entryNot);
        }
Ejemplo n.º 20
0
        public void SetUp()
        {
            fakeDoor      = new FakeDoor();
            fakeAlarm     = new FakeAlarm();
            fakeNotifier  = new FakeNotifier();
            fakeValidator = new FakeValidator();

            doorControl = new DoorControl(fakeDoor, fakeAlarm, fakeValidator, fakeNotifier);
        }
Ejemplo n.º 21
0
 private void SetDors()
 {
     foreach (Door door in doors)
     {
         DoorControl control = new DoorControl();
         canvas.Children.Add(control);
         control.SetValue(Canvas.TopProperty, door.y * 20.0 + 1);
         control.SetValue(Canvas.LeftProperty, door.x * 10.0 + 1);
     }
 }
        public void Setup()
        {
            _state      = new StubDoorControlState();
            _validation = new StubUserValidation();
            _alarm      = Substitute.For <IAlarm>();
            _door       = Substitute.For <IDoor>();
            _entry      = Substitute.For <IEntryNotification>();

            _UUT = new DoorControl(_state, _door, _validation, _entry, _alarm);
        }
Ejemplo n.º 23
0
    void OnTriggerEnter(Collider other)
    {
        DoorControl door = device.GetComponent <DoorControl> ();

        if (door != null)
        {
            door.Operate();
        }
        doorPopup.Open();
    }
Ejemplo n.º 24
0
        public void Setup()
        {
            Alarm             = Substitute.For <IAlarm>();
            Door              = Substitute.For <IDoor>();
            EntryNotification = Substitute.For <IEntryNotification>();
            UserValidation    = Substitute.For <IUserValidation>();


            _uut = new DoorControl(Alarm, Door, EntryNotification, UserValidation);
        }
Ejemplo n.º 25
0
    public IEnumerator Test_DoorControlKnowsItsEnemies()
    {
        GameObject  enemies = CreateEnemiesToWaitFor(2);
        DoorControl door    = CreateDoorControl(enemies, new Vector3(1, 1, 1));

        yield return(new WaitForEndOfFrame());

        Assert.IsNotNull(door.GetEnemies(), "Enemies to wait for were not correctly initialized!");
        Assert.NotZero(door.GetEnemies().Count, "Door Control did not find any enemies!");
        Assert.IsTrue(door.GetEnemies().Count == 2, "Door Control did not know all of the enemies it should!");
    }
        public void Setup()
        {
            Alarm             = Substitute.For <IAlarm>();
            Door              = Substitute.For <IDoor>();
            EntryNotification = Substitute.For <IEntryNotification>();
            UserValidation    = Substitute.For <IUserValidation>();


            _uut = new DoorControl(Alarm, Door, EntryNotification, UserValidation);
            UserValidation.ValidateEntryRequest("TFJ").Returns(true);
        }
    public void ValidateAnswer()
    {
        string answer = _passcodeMenu.transform.Find("TxtPasscode").GetComponent <InputField>().text;

        int  intAnswer = 0;
        bool isValid   = int.TryParse(answer, out intAnswer);

        if (_doorInstance != null)
        {
            if (intAnswer == _doorInstance._randInteger && isValid)
            {
                _doorInstance._isSolved = true;
                _isPaused = false;
                _passcodeMenu.SetActive(false);
                _doorInstance.Open();
                _doorInstance = null;
            }
            else
            {
                _passcodeMenu.SetActive(false);
                GenericPause("Wrong answer");
            }
        }
        else if (_fragmentInstance != null)
        {
            int result = Convert.ToInt32(NumeralConverter.ConvertRomanToDecimal(answer));
            if (result == _fragmentInstance._passcode)
            {
                _passcodeMenu.SetActive(false);
                StringBuilder sb = new StringBuilder();
                foreach (char numeral in _fragmentInstance._numerals)
                {
                    sb.Append(numeral);
                }

                string numeralResult = sb.ToString();
                _txtRomanNumeralData.GetComponent <Text>().text += sb.ToString();
                Destroy(_fragmentInstance.gameObject);
                _fragmentInstance = null;
                GenericPause("You found some Numerals in a memory fragment. Maybe this is a clue to get to the core? \r\n" + numeralResult);
            }
            else
            {
                _passcodeMenu.SetActive(false);
                GenericPause("Wrong answer");
            }
        }
        _passcodeMenu.transform.Find("TxtPasscode").GetComponent <InputField>().text = "";
    }
Ejemplo n.º 28
0
    //OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        this.animator = animator;
        gameObject    = animator.gameObject;
        originScale   = gameObject.transform.localScale;
        unit          = gameObject.GetComponent <UnitBehaviour>();

        RaycastHit2D hit;

        hit  = Physics2D.Raycast(gameObject.transform.position, Vector2.up, 0.01f, LayerMask.GetMask("Door"));
        door = hit.collider.GetComponent <DoorControl>();
        gameObject.GetComponent <Rigidbody2D>().velocity = Vector2.zero;

        Enter();
    }
Ejemplo n.º 29
0
        protected override void DefineStaticObjects()
        {
            Lights ll = new Lights();

            ll.TurnOff();
            this.PlaceObjectTo(new int2(5, 5), ll);

            LightsControl lc = new LightsControl();

            lc.myObjects.Add(ll);
            lc.TurnOff();
            this.PlaceObjectTo(new int2(1, 1), lc);

            Lights lll = new Lights();

            lll.TurnOn();
            this.PlaceObjectTo(new int2(2, 5), lll);

            LightsControl lcc = new LightsControl();

            lcc.myObjects.Add(lll);
            lcc.TurnOn();
            this.PlaceObjectTo(new int2(4, 7), lcc);

            MyDoor door = new MyDoor();

            door.TurnOff();
            this.PlaceObjectTo(new int2(5, 1), door);

            DoorControl dc = new DoorControl();

            dc.myObjects.Add(door);
            dc.TurnOff();
            this.PlaceObjectTo(new int2(7, 7), dc);

            MyDoor door2 = new MyDoor();

            door2.TurnOn();
            this.PlaceObjectTo(new int2(7, 4), door2);

            DoorControl dc2 = new DoorControl();

            dc2.myObjects.Add(door);
            dc2.TurnOn();
            this.PlaceObjectTo(new int2(2, 8), dc2);

            StaticObjects = new MyStaticObject[] { ll, lc, lll, lcc, door2, dc2, door, dc };
        }
Ejemplo n.º 30
0
        protected override void DefineStaticObjects()
        {
            MyDoor door2 = new MyDoor();

            door2.TurnOff();
            this.PlaceObjectTo(new int2(2, 3), door2);

            DoorControl dc = new DoorControl();

            dc.myObjects.Add(door2);
            this.PlaceObjectTo(new int2(0, 2), dc);

            DoorControl dc2 = new DoorControl();

            dc2.myObjects.Add(door2);
            this.PlaceObjectTo(new int2(1, 4), dc2);


            StaticObjects = new MyStaticObject[] { door2, dc, dc2 };//,lll,llll};
        }
Ejemplo n.º 31
0
    public bool Attack(int damage)
    {
        switch (ItemType)
        {
        case NPC_TYPE:
        {
            NPC npc = this.GetComponent <NPC>();
            npc.ApplyAttack(damage);
            break;
        }

        case DOOR:
        case HIDDENDOOR:
        {
            DoorControl dc = this.GetComponent <DoorControl>();
            dc.ApplyAttack(damage);
            break;
        }
        }
        return(true);
    }
Ejemplo n.º 32
0
        protected override void DefineStaticObjects()
        {
            // place into the map
            MyDoor door = new MyDoor();
            door.TurnOff();
            this.PlaceObjectTo(new int2(12, 5), door);

            DoorControl dc = new DoorControl();
            dc.myObjects.Add(door);
            dc.TurnOff();
            this.PlaceObjectTo(new int2(9, 9), dc);

            DoorControl dc2 = new DoorControl();
            dc2.myObjects.Add(door);
            dc2.TurnOff();
            this.PlaceObjectTo(new int2(10, 1), dc2);

            Lights l = new Lights();
            l.TurnOff();
            this.PlaceObjectTo(new int2(5, 5), l);

            Lights ll = new Lights();
            ll.TurnOff();
            this.PlaceObjectTo(new int2(1, 1), ll);

            LightsControl lc = new LightsControl();
            lc.myObjects.Add(l);
            lc.myObjects.Add(ll);
            lc.TurnOff();
            this.PlaceObjectTo(new int2(6, 6), lc);

            StaticObjects = new MyStaticObject[] { dc, door, dc2, lc, l, ll };
        }
Ejemplo n.º 33
0
        protected override void DefineStaticObjects()
        {
            MyDoor door2 = new MyDoor();
            door2.TurnOff();
            this.PlaceObjectTo(new int2(2, 3), door2);

            DoorControl dc = new DoorControl();
            dc.myObjects.Add(door2);
            this.PlaceObjectTo(new int2(0, 2), dc);

            DoorControl dc2 = new DoorControl();
            dc2.myObjects.Add(door2);
            this.PlaceObjectTo(new int2(1, 4), dc2);

            StaticObjects = new MyStaticObject[] { door2, dc, dc2 };//,lll,llll};
        }
Ejemplo n.º 34
0
	// ================================================================ //
	// 비헤이비어가 사용하는 커맨드.
	// 이벤트 박스.

	// 문 앞에 있는 동안 호출한다.
	public void		cmdNotiryStayDoorBox(DoorControl door)
	{
		this.door = door;
	}
Ejemplo n.º 35
0
        protected override void DefineStaticObjects()
        {
            Lights ll = new Lights();
            ll.TurnOff();
            this.PlaceObjectTo(new int2(5, 5), ll);

            LightsControl lc = new LightsControl();
            lc.myObjects.Add(ll);
            lc.TurnOff();
            this.PlaceObjectTo(new int2(1, 1), lc);

            Lights lll = new Lights();
            lll.TurnOn();
            this.PlaceObjectTo(new int2(2, 5), lll);

            LightsControl lcc = new LightsControl();
            lcc.myObjects.Add(lll);
            lcc.TurnOn();
            this.PlaceObjectTo(new int2(4, 7), lcc);

            MyDoor door = new MyDoor();
            door.TurnOff();
            this.PlaceObjectTo(new int2(5, 1), door);

            DoorControl dc = new DoorControl();
            dc.myObjects.Add(door);
            dc.TurnOff();
            this.PlaceObjectTo(new int2(7, 7), dc);

            MyDoor door2 = new MyDoor();
            door2.TurnOn();
            this.PlaceObjectTo(new int2(7, 4), door2);

            DoorControl dc2 = new DoorControl();
            dc2.myObjects.Add(door);
            dc2.TurnOn();
            this.PlaceObjectTo(new int2(2, 8), dc2);

            StaticObjects = new MyStaticObject[] { ll, lc, lll, lcc, door2, dc2, door, dc };
        }
Ejemplo n.º 36
0
        protected override void DefineStaticObjects()
        {
            Lights ll = new Lights();
            ll.TurnOn();
            this.PlaceObjectTo(new int2(7, 7), ll);

            LightsControl lc = new LightsControl();
            lc.myObjects.Add(ll);
            lc.TurnOn();
            this.PlaceObjectTo(new int2(1, 1), lc);

            /*
            // place into the map
            Door door = new Door();
            door.turnOff();
            this.placeObjectTo(new int2(5, 4), door);
            */
            MyDoor door2 = new MyDoor();
            door2.TurnOff();
            this.PlaceObjectTo(new int2(5, 5), door2);

            /*
            DoorControl dc = new DoorControl();
            //dc.myObjects.Add(door);
            dc.myObjects.Add(door2);
            this.PlaceObjectTo(new int2(1, 8), dc);
            */

            DoorControl dc2 = new DoorControl();
            //dc2.myObjects.Add(door);
            dc2.myObjects.Add(door2);
            dc2.TurnOff();
            this.PlaceObjectTo(new int2(8, 1), dc2);
            StaticObjects = new MyStaticObject[] { ll, lc, dc2, door2 };
        }
Ejemplo n.º 37
0
 // Use this for initialization
 void Start()
 {
     control = GetComponent<DoorControl> ();
     if (control != null)
         control.OnActivate += TrapDatJunk;
 }
Ejemplo n.º 38
0
	public void RegisterDoor(DoorControl door)
	{
		doors.Add(door);
		door.SetRoom(this);
	}
Ejemplo n.º 39
0
	public override	void	execute()
	{
		this.door = null;

		// 파워업 타이머
		// (캔디를 획득했을 때).
		if(this.shot_boost_timer > 0.0f) {

			this.shot_boost_timer -= Time.deltaTime;

			if(this.shot_boost_timer <= 0.0f) {

				// 타임아웃으로 효과 끝남.

				this.shot_boost_timer = 0.0f;

				ItemWindow.get().clearItem(Item.SLOT_TYPE.CANDY, 0);

				this.item_slot.candy.initialize();
			}
		}

		this.melee_attack.execute();

		if(this.ice_timer >= 0.0f) {

			this.ice_timer -= Time.deltaTime;
		}

		this.executeJinJin();

		this.skin_color_control.execute();

		this.execute_queries();
	}
Ejemplo n.º 40
0
	// 문을 만든다(하나).
	public DoorControl		create_door(DoorControl.TYPE type, Map.RoomIndex room_index, Map.BlockIndex block_index, Map.EWSN dir, int key_type)
	{
		GameObject	prefab;

		if(type == DoorControl.TYPE.ROOM) {

			prefab = this.door_prefabs[key_type%(this.door_prefabs.Length - 1)];

		} else {

			prefab = this.door_prefabs[this.door_prefabs.Length - 1];
		}

		GameObject		go   = GameObject.Instantiate(prefab) as GameObject;
		
		DoorControl		door = go.AddComponent<DoorControl>();
		
		door.room_index = room_index;
		
		door.type     = type;
		door.KeyType  = key_type;
		door.door_dir = dir;

		//
		
		RoomController	room = this.get_room_root_go(room_index);

		go.transform.parent = room.transform;
		go.transform.localPosition = this.getBlockCenterPosition(block_index);

		room.RegisterDoor(door);
		
		return(door);
	}
Ejemplo n.º 41
0
        protected override void DefineStaticObjects()
        {
            // place into the map
            MyDoor door = new MyDoor();
            door.TurnOn();
            this.PlaceObjectTo(new int2(2, 3), door);

            DoorControl dc = new DoorControl();
            dc.myObjects.Add(door);
            dc.TurnOn();
            this.PlaceObjectTo(new int2(11, 7), dc);

            MyDoor door2 = new MyDoor();
            door2.TurnOn();
            this.PlaceObjectTo(new int2(7, 7), door2);

            DoorControl dc2 = new DoorControl();
            dc2.myObjects.Add(door2);
            dc2.TurnOn();
            this.PlaceObjectTo(new int2(12, 3), dc2);

            Lights l = new Lights();
            l.TurnOff();
            this.PlaceObjectTo(new int2(3, 7), l);

            LightsControl lc = new LightsControl();
            lc.myObjects.Add(l);
            lc.TurnOff();
            this.PlaceObjectTo(new int2(0, 0), lc);

            StaticObjects = new MyStaticObject[] { dc, door, door2, dc2, l, lc };
        }
Ejemplo n.º 42
0
	// 플로어 이동 문을 만든다.
	public void		createFloorDoor(Map.RoomIndex room_index, Map.BlockIndex block_index, Map.EWSN door_dir)
	{
		bossDoor = this.create_door(DoorControl.TYPE.FLOOR, room_index, block_index, door_dir, 4);
	}
Ejemplo n.º 43
0
	public RoomController FindRoomByDoor(DoorControl door)
	{
		return door.GetRoom();
	}
Ejemplo n.º 44
0
        protected override void DefineStaticObjects()
        {
            Lights ll = new Lights();
            ll.TurnOn();
            this.PlaceObjectTo(new int2(6, 0), ll);

            LightsControl lc = new LightsControl();
            lc.myObjects.Add(ll);
            lc.TurnOn();
            this.PlaceObjectTo(new int2(1, 1), lc);

            // lights control
            Lights llX = new Lights();
            llX.TurnOn();
            this.PlaceObjectTo(new int2(6, 9), llX);

            LightsControl lcX = new LightsControl();
            lcX.myObjects.Add(llX);
            lcX.TurnOn();
            this.PlaceObjectTo(new int2(9, 9), lcX);

            // place into the map
            MyDoor doorX = new MyDoor();
            doorX.TurnOff();
            this.PlaceObjectTo(new int2(8, 6), doorX);

            DoorControl doorControlX = new DoorControl();
            doorControlX.myObjects.Add(doorX);
            doorControlX.TurnOff();
            this.PlaceObjectTo(new int2(4, 7), doorControlX);

            // door 2 with two controls
            MyDoor door2 = new MyDoor();
            door2.TurnOff();
            this.PlaceObjectTo(new int2(5, 5), door2);

            DoorControl dc = new DoorControl();
            //dc.myObjects.Add(door);
            dc.myObjects.Add(door2);
            dc.TurnOff();
            this.PlaceObjectTo(new int2(1, 8), dc);

            DoorControl dc2 = new DoorControl();
            //dc2.myObjects.Add(door);
            dc2.myObjects.Add(door2);
            dc2.TurnOff();
            this.PlaceObjectTo(new int2(8, 1), dc2);

            StaticObjects = new MyStaticObject[] { dc, dc2, door2, doorX, doorControlX, lcX, llX, ll, lc };
        }
Ejemplo n.º 45
0
	void Awake() {
		control = GetComponentInChildren<DoorControl> ();
	}
Ejemplo n.º 46
0
	public override void	execute()
	{
		CameraControl		camera = CameraControl.getInstance();

		float	camera_move_time = 1.5f;
		float	ready_time = 1.5f;


		// ---------------------------------------------------------------- //
		// 다음 상태로 전환할지 체크.

		switch(this.step.do_transition()) {

			case STEP.START:
			{
				this.step.set_next(STEP.HOLE_IN);
			}
			break;

			case STEP.HOLE_IN:
			{
				// 플레이어가 모두 구멍에 들어갔으면.
				// ('구멍에 들어가지 않은 플레이어'가 없으면).
				if(!this.player_steps.Exists(x => !x.step_hole_in.is_done)) {

					if(this.is_end_at_hole_in) {

						// '구멍에 들어갈 때까지'일 때(플로어 이동문일 때)는 끝.
						this.step.set_next(STEP.END);

					} else {

						this.step.set_next(STEP.CAMERA_MOVE);
					}
				}
			}
			break;

			case STEP.CAMERA_MOVE:
			{
				if(this.step.get_time() >= camera_move_time) {

					this.step.set_next(STEP.HOLE_OUT);
				}
			}
			break;

			case STEP.HOLE_OUT:
			{
				if(!this.player_steps.Exists(x => !x.ip_jump.isDone())) {

					this.step.set_next(STEP.READY);
				}
			}
			break;

			case STEP.READY:
			{
				if(this.step.get_time() >= ready_time) {

					this.step.set_next(STEP.END);
				}
			}
			break;

			case STEP.END:
			{
				foreach(PlayerStep player_step in this.player_steps) {

					player_step.player.endOuterControll();
				}
				camera.endOuterControll();

				this.step.set_next(STEP.IDLE);
			}
			break;
		}

		// ---------------------------------------------------------------- //
		// 상태 전환 시 초기화.

		while(this.step.get_next() != STEP.NONE) {

			switch(this.step.do_initialize()) {
	
				case STEP.START:
				{
					// 이벤트 시작.

					this.player_steps.Clear();

					List<chrBehaviorPlayer>		players = PartyControl.get().getPlayers();

					foreach(chrBehaviorPlayer player in players) {

						PlayerStep		player_step = new PlayerStep();

						player_step.player = player;

						this.player_steps.Add(player_step);
					}

					foreach(PlayerStep player_step in this.player_steps) {

						player_step.player.beginOuterControll();
						player_step.player.control.cmdEnableCollision(false);
						player_step.player.rigidbody.useGravity = false;
					}

					// 연주 시작.
					SoundManager.getInstance().playSE(Sound.ID.DDG_SE_SYS05);

					camera.beginOuterControll();

				}
				break;

				case STEP.HOLE_IN:
				{
				}
				break;

				case STEP.CAMERA_MOVE:
				{
					// 벽의 페이드 인/ 페이드 아웃.

					if(this.door.door_dir == Map.EWSN.NORTH) {

						List<RoomWallControl> 	walls = this.door.connect_to.GetRoom().GetRoomWalls(Map.EWSN.SOUTH);
	
						foreach(RoomWallControl wall in walls) {
	
							wall.FadeOut();
						}

					} else if(this.door.door_dir == Map.EWSN.SOUTH) {

						List<RoomWallControl> 	walls = this.door.GetRoom().GetRoomWalls(Map.EWSN.SOUTH);
	
						foreach(RoomWallControl wall in walls) {
	
							wall.FadeIn();
						}
					}

					this.step_camera_move.start_interest = camera.calcGroundLevelInterest();
				}
				break;

				case STEP.HOLE_OUT:
				{
					float	peak  = 5.0f;
					float	delay = 0.0f;

					foreach(PlayerStep player_step in this.player_steps) {

						chrBehaviorPlayer	player = player_step.player;

						float	y_angle = door_dir_to_y_angle(this.door.door_dir);

						// 착지할 장소   캐릭터 마다 다르다.
						Vector3		landing_position = this.calc_landing_position(player);

						Vector3		start = this.door.connect_to.transform.position;
						Vector3		goal  = start + landing_position;

						player_step.step_hole_out.position = start;
						player_step.step_hole_out.delay    = delay;

						player_step.ip_jump.setBounciness(new Vector3(0.0f, -0.5f, 0.0f));
						player_step.ip_jump.start(start, goal, peak);

						player_step.step_hole_out.pivot = landing_position;
						player_step.step_hole_out.pivot.Normalize();
						player_step.step_hole_out.pivot = Quaternion.AngleAxis(90.0f, Vector3.up)*player_step.step_hole_out.pivot;
						player_step.step_hole_out.omega = 360.0f/(player_step.ip_jump.t0 + player_step.ip_jump.t1);
	
						player.control.cmdSetPosition(player_step.step_hole_out.position);
						player.control.cmdSetDirection(y_angle);

						player.getModel().SetActive(false);
						player.getModel().transform.localPosition = player.getInitialLocalPositionModel();
						player.getModel().transform.localScale = Vector3.one;
					
						delay += 0.2f;
					}
				}
				break;

				case STEP.READY:
				{
					this.step_ready.start_interest = camera.calcGroundLevelInterest();
				}
				break;

				case STEP.END:
				{
					// 이벤트 종료.

					foreach(PlayerStep player_step in this.player_steps) {

						chrBehaviorPlayer	player = player_step.player;

						Vector3		landing_position = this.calc_landing_position(player);

						if(this.door.connect_to != null) {

							player_step.player.control.cmdSetPositionAnon(this.door.connect_to.transform.position + landing_position);
						}
						player_step.player.rigidbody.useGravity = true;
						player_step.player.control.cmdEnableCollision(true);
					}

					this.door.beginSleep();

					if(this.door.connect_to != null) {

						this.door.connect_to.beginWaitLeave();
						PartyControl.get().setCurrentRoom(this.door.connect_to.GetRoom());
					}

					this.door = null;
				}
				break;
			}
		}

		// ---------------------------------------------------------------- //
		// 각 상태에서의 실행 처리.

		switch(this.step.do_execution(Time.deltaTime)) {

			case STEP.IDLE:
			{
			}
			break;


			case STEP.HOLE_IN:
			{
				foreach(PlayerStep player_step in this.player_steps) {

					chrBehaviorPlayer	player = player_step.player;
				
					if(player_step.step_hole_in.is_done) {

						continue;
					}

					// 위치.

					Vector3		player_position = player.control.getPosition();
					Vector3		door_position   = this.door.gameObject.transform.position;
	
					Vector3		distance = player_position - door_position;
	
					distance.y = 0.0f;
	
					float	speed;
					float	tangent_speed;
					float	rotate_speed;
	
					float	radius = distance.magnitude;
	
					speed = Mathf.InverseLerp(5.0f, 0.0f, radius);
					speed = Mathf.Clamp01(speed);
					speed = Mathf.Lerp(10.0f, 0.2f, speed)*Time.deltaTime;
	
					tangent_speed = Mathf.InverseLerp(5.0f, 0.1f, radius);
					tangent_speed = Mathf.Clamp01(tangent_speed);
					tangent_speed = Mathf.Lerp(0.01f, 15.0f, tangent_speed)*Time.deltaTime;
	
					rotate_speed = Mathf.InverseLerp(5.0f, 0.1f, radius);
					rotate_speed = Mathf.Clamp01(rotate_speed);
					rotate_speed = Mathf.Pow(rotate_speed, 2.0f);
					rotate_speed = Mathf.Lerp(0.2f, 1.0f, rotate_speed)*360.0f*Time.deltaTime;
	
					if(distance.magnitude > speed) {
	
						distance -= distance.normalized*speed;
	
						float	angle = Mathf.Atan2(tangent_speed, distance.magnitude)*Mathf.Rad2Deg;
	
						angle = Mathf.Min(angle, 20.0f);
	
						distance = Quaternion.AngleAxis(angle, Vector3.up)*distance;
	
						player_position = door_position + distance;
	
					} else {
	
						player_step.step_hole_in.is_done = true;
	
						player_position = door_position;
					}
	
					player.control.cmdSetPositionAnon(player_position);

					// 로테이션.
	
					player.transform.Rotate(Vector3.up, rotate_speed);

					// 스케일.

					player.rigidbody.velocity = Vector3.zero;
	
					float	scale;
	
					scale = Mathf.InverseLerp(0.5f, 0.0f, radius);
					scale = Mathf.Clamp01(scale);
					scale = Mathf.Lerp(1.0f, 0.2f, scale);

					player.getModel().transform.localPosition = player.getInitialLocalPositionModel()*scale;
					player.getModel().transform.localScale = scale*Vector3.one;

					if(player_step.step_hole_in.is_done) {

						player.getModel().SetActive(false);
					}
				}
	
				// 카메라.

				Vector3		p0 = camera.calcGroundLevelInterest();
				Vector3		p1 = Vector3.Lerp(p0, this.door.transform.position, 0.01f);

				camera.getModule().parallelInterestTo(p1);
			}
			break;

			case STEP.CAMERA_MOVE:
			{
				float		ratio = this.step.get_time()/camera_move_time;

				ratio = Mathf.Clamp01(ratio);
				ratio = Mathf.Sin(ratio*Mathf.PI/2.0f);

				Vector3		p0 = this.step_camera_move.start_interest;
				Vector3		p1 = this.door.connect_to.transform.position;

				p1 = Vector3.Lerp(p0, p1, ratio);

				camera.getModule().parallelInterestTo(p1);
			}
			break;

			case STEP.HOLE_OUT:
			{
				foreach(PlayerStep player_step in this.player_steps) {

					if(this.step.get_time() < player_step.step_hole_out.delay) {

						continue;
					}

					chrBehaviorPlayer	player = player_step.player;

					player.getModel().SetActive(true);

					if(player_step.ip_jump.isDone()) {

						continue;
					}
					player_step.ip_jump.execute(Time.deltaTime);

					player_step.step_hole_out.position = player_step.ip_jump.position;
		
					float		ratio = this.step.get_time()/(player_step.ip_jump.t0 + player_step.ip_jump.t1);
	
					ratio = Mathf.Clamp01(ratio);
					ratio = Mathf.Pow(ratio, 0.35f);
					ratio = Mathf.Lerp(-360.0f*1.5f, 0.0f, ratio);
	
					player.getModel().transform.localRotation = Quaternion.AngleAxis(ratio, player_step.step_hole_out.pivot);
	
					player.control.cmdSetPosition(player_step.step_hole_out.position);
				}
			}
			break;

			case STEP.READY:
			{
				float		ratio = this.step.get_time()/ready_time;

				ratio = Mathf.Clamp01(ratio);
				ratio = Mathf.Lerp(-Mathf.PI/2.0f, Mathf.PI/2.0f, ratio);
				ratio = Mathf.Sin(ratio);
				ratio = Mathf.InverseLerp(-1.0f, 1.0f, ratio);

				Vector3		p0 = this.step_ready.start_interest;
				Vector3		p1 = PartyControl.get().getLocalPlayer().control.getPosition();

				p1 = Vector3.Lerp(p0, p1, ratio);

				camera.getModule().parallelInterestTo(p1);
			}
			break;
		}

		// ---------------------------------------------------------------- //
	}
Ejemplo n.º 47
0
        protected override void DefineStaticObjects()
        {
            Lights ll = new Lights();
            ll.TurnOff();
            this.PlaceObjectTo(new int2(4, 4), ll);
            /*
            Lights lll = new Lights();
            lll.TurnOff();
            this.PlaceObjectTo(new int2(2, 5), lll);

            Lights llll = new Lights();
            llll.TurnOff();
            this.PlaceObjectTo(new int2(2, 2), llll);

            */
            LightsControl lc = new LightsControl();
            lc.TurnOff();
            lc.myObjects.Add(ll);
            this.PlaceObjectTo(new int2(2, 2), lc);

            MyDoor door2 = new MyDoor();
            door2.TurnOff();
            this.PlaceObjectTo(new int2(4, 2), door2);

            DoorControl dc = new DoorControl();
            dc.myObjects.Add(door2);
            this.PlaceObjectTo(new int2(2, 4), dc);

            StaticObjects = new MyStaticObject[] { ll, lc, door2, dc };//,lll,llll};
        }
Ejemplo n.º 48
0
	// ================================================================ //

	// 문 설정.
	public void		setDoor(DoorControl door)
	{
		this.door = door;
	}