Пример #1
0
    public void door_process()
    {
        ////////mark
        ///
        if (door_transition == null)
        {
            return;
        }

        gameManager.player_turn = false;

        playerbase.unactive();
        gameManager.sub_managers.boardManager.room_transition(door_transition.connected_roommeta);
        playerbase.node_change(get_next_node(playerbase));
        Vector3 from_pos = playerbase.node_now.position;

        playerbase.ObjectBody.transform.position = playerbase.node_now.position;

        //playerbase.node_change(get_next_node(playerbase));
        playerbase.move(get_next_node(playerbase));
        Vector3 to_pos = playerbase.node_now.position;

        playerbase.ObjectBody.SetActive(true);


        //int _UDLR = direction(from_node, to_node);
        //animManager.run_animation_withoutbase(playerbase.ObjectBody, AnimType.MOVE, _UDLR, from_node.position, to_node.position);

        door_transition = null;
        process_continue();
    }
Пример #2
0
        public override void OnInspectorGUI()
        {
            this.DrawDefaultInspector();

            this.serializedObject.UpdateIfRequiredOrScript();

            DoorBase door = (DoorBase)this.target;

            if (GUILayout.Button("Mark Transform as Open"))
            {
                this.markAsOpen(door);
            }
            if (GUILayout.Button("Mark Transfrom as Closed"))
            {
                this.markAsClosed(door);
            }

            if (GUILayout.Button("Open Door"))
            {
                door.setAsOpen();
            }
            if (GUILayout.Button("Close Door"))
            {
                door.setAsClosed();
            }

            this.serializedObject.ApplyModifiedProperties();
        }
Пример #3
0
    public override void onRightClick(Player player)
    {
        base.onRightClick(player);

        if (this.isPickingLock())
        {
            this.door      = null;
            this.pickTimer = 0;
        }
        else
        {
            if (this.pickTimer <= 0)
            {
                Camera     c = player.getCamera();
                RaycastHit hit;
                if (player.raycast(out hit, this.data.reach))
                {
                    DoorBase door = hit.transform.GetComponent <DoorBase>();
                    if (door != null)
                    {
                        if (door.isLocked)
                        {
                            this.pickTimer = this.data.pickTime;
                            this.door      = door;
                        }
                    }
                }
            }
        }
    }
Пример #4
0
 private static void Postfix(DoorBase door, ref bool __result)
 {
     if (GameplayManager.IsMultiplayerActive)
     {
         __result = true;
     }
 }
Пример #5
0
    public override bool interaction(ObjectBase objectBase, ObjectBase targetBase)     // 삭제시 true;
    {
        if (targetBase.is_alive == false)
        {
            Debug.Log("THIS SELFFLASE");
            return(false);
        }

        if (targetBase is DoorBase)
        {
            //door_process((DoorBase)targetBase);
            door_transition = (DoorBase)targetBase;
            continue_turn   = true;
            return(false);
        }
        else if (targetBase is ItemBase)
        {
            if (targetBase.interaction(objectBase))
            {
                return(true);                                                // 삭제 됐으면?////
            }
            else
            {
                return(false);
            }
        }

        else
        {
            targetBase.interaction(objectBase);
            return(false);
        }
    }
Пример #6
0
 public void create()
 {
     if (doorvars == null)
     {
         doorvars = somefunctions.InstantiatePrefabGmbjct("obstacles/door " + doortype, room.transform).GetComponent <DoorBase>();
     }
     doorvars.doorvars = this;
     doorvars.room     = room;
     exists            = true;
     isOpen            = defaultdoorstate;
 }
Пример #7
0
    public void Next()
    {
        DoorBase top = doorList[0];

        doorList.RemoveAt(0);
        GameObject target;

        if (top.type == MapType.road)
        {
            int idx = UnityEngine.Random.Range(0, roomLen);
            target = roomPrefab[idx];
        }
        else
        {
            int idx = UnityEngine.Random.Range(0, roadLen);
            target = roadPrefab[idx];
        }
        GameObject nextPrefab = GameObject.Instantiate(target, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;

        nextPrefab.transform.SetParent(this.gameObject.transform);
        Transform trans = nextPrefab.transform.GetChild(0);

        if (NumberEqual(-top.trans.eulerAngles.y + trans.eulerAngles.y, 180) || NumberEqual(-top.trans.eulerAngles.y + trans.eulerAngles.y, -180))
        {
        }
        else
        {
            int aim = 0;
            if (top.trans.eulerAngles.y > 0)
            {
                aim = (int)(top.trans.eulerAngles.y) - 180;
            }
            else
            {
                aim = (int)(top.trans.eulerAngles.y) + 180;
            }
            MyRotate(nextPrefab.transform, new Vector3(0, aim - (int)(trans.eulerAngles.y), 0));
        }
        Debug.Log(top.trans.position + "  " + trans.position);
        nextPrefab.transform.position = nextPrefab.transform.position + (top.trans.position - trans.position);
        SetPosition(nextPrefab.transform, 1);
    }
Пример #8
0
    public void update()
    {
        if (this.door != null)
        {
            // Break down door
            this.timer += Time.deltaTime;

            if (this.timer > 1.25f)
            {
                this.timer = 0f;
                this.door.strength--;
                this.door.audioBreakingDoor.Play();
            }

            if (this.door.strength <= 0)
            {
                this.door.destroyDoor();

                this.agent.isStopped = false;
                this.door            = null;
            }
        }
    }
    //EffectPool effectPool = GameManager.Instance.pools.effectPool;

    public void run_coroutine(List <AnimObject> sub_animObjects)
    {
        while (sub_animObjects.Count > 0)
        {
            AnimObject animObject = sub_animObjects[0];
            if (animObject.objectBase.ObjectBody == null)
            {
                switch (animObject.objectBase.objectBase_type)
                {
                case ObjectBaseType.BLOCK:
                    BlockBase blockBase = ((BlockBase)animObject.objectBase);
                    GameManager.Instance.pools.objectBodyPool.get_body(blockBase.blockType, blockBase.node_now.position);
                    break;

                case ObjectBaseType.CHARACTER:
                    PlayerBase playerBase = ((PlayerBase)animObject.objectBase);
                    GameManager.Instance.pools.objectBodyPool.get_body(playerBase.monsterType, playerBase.node_now.position);
                    break;

                case ObjectBaseType.DOOR:
                    DoorBase doorBase = ((DoorBase)animObject.objectBase);
                    GameManager.Instance.pools.objectBodyPool.get_body(doorBase.doorType, doorBase.node_now.position, animObject.UDLR);
                    break;

                case ObjectBaseType.ITEM:
                    ItemBase itemBase = ((ItemBase)animObject.objectBase);
                    GameManager.Instance.pools.objectBodyPool.get_body(itemBase.itemType, itemBase.node_now.position);
                    break;

                case ObjectBaseType.MONSTER:
                    MonsterBase monsterBase = ((MonsterBase)animObject.objectBase);
                    GameManager.Instance.pools.objectBodyPool.get_body(monsterBase.monsterType, monsterBase.node_now.position);
                    break;

                case ObjectBaseType.TRAP:
                    TrapBase trapBase = ((TrapBase)animObject.objectBase);
                    GameManager.Instance.pools.objectBodyPool.get_body(trapBase.trapType, trapBase.node_now.position);
                    break;
                }
            }
            else
            {
                animObject.objectBase.ObjectBody.SetActive(true);
            }

            if (animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow != null)
            {
                StopCoroutine(animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow);
                GameManager.Instance.sub_managers.animManager.running_list--;
                animObject.objectBase.ObjectBody.GetComponentInChildren <Animator>().SetInteger("MoveType", (int)AnimType.IDLE);
                recall(animObject);
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = null;
            }

            switch (animObject.animType)
            {
            case AnimType.ATTACK:
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(attack(animObject, sub_animObjects));
                break;

            case AnimType.CANNOTATTACK:
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(cannot_attack(animObject, sub_animObjects));
                break;

            case AnimType.HIT:
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(hit(animObject, sub_animObjects));
                break;

            case AnimType.DEATH:
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(death(animObject, sub_animObjects));
                break;

            case AnimType.DEATHWITHOUTDELAY:
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(death_withoutdelay(animObject, sub_animObjects));
                break;

            case AnimType.MOVE:
                //animObject.objectBase.ObjectBody.GetComponentInChildren<Animator>().SetInteger("MoveType", (int)AnimType.LANDING);
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(move(animObject, sub_animObjects));

                break;

            case AnimType.FASTMOVE:
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(fast_move(animObject, sub_animObjects));
                break;

            case AnimType.TRY:
                //StartCoroutine(try_something(animObject, sub_animObjects));
                break;

            case AnimType.LANDING:
                animObject.objectBase.ObjectBody.GetComponentInChildren <Animator>().SetInteger("MoveType", (int)AnimType.LANDING);
                recall(animObject);
                break;

            case AnimType.HIGHLIGHT:
                if (!highlightlist.Contains(animObject.objectBase.ObjectBody))
                {
                    highlightlist.Add(animObject.objectBase.ObjectBody);
                }
                break;

            case AnimType.HIT_WITHBLOOD:
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(hit_withblood(animObject, sub_animObjects));
                break;

            case AnimType.HIT_WITHOUTBLOOD:
                animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(hit_withoutblood(animObject, sub_animObjects));
                break;

            case AnimType.ITEMEFFECT:
                StartCoroutine(itemeffect(animObject));
                break;
            }
            sub_animObjects.RemoveAt(0);
        }
        if (!highlightisRunning && highlightlist.Count > 0)
        {
            StartCoroutine(highlight(sub_animObjects));
        }
    }
Пример #10
0
 public override void markAsOpen(DoorBase door)
 {
     this.rightOpenState.quaternionValue = ((DoorDouble)door).right.transform.localRotation;
     this.leftOpenState.quaternionValue  = ((DoorDouble)door).left.transform.localRotation;
 }
Пример #11
0
        public override void PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
        {
            byte direction = player.GetDirection();

            var coordinates = GetNewCoordinatesFromFace(blockCoordinates, face);

            // Base block, meta sets orientation
            DoorBase block = (DoorBase)BlockFactory.GetBlockById(_blockId);

            block.Coordinates   = coordinates;
            block.Direction     = direction;
            block.UpperBlockBit = false;

            int x = blockCoordinates.X;
            int y = blockCoordinates.Y;
            int z = blockCoordinates.Z;

            int xd = 0;
            int zd = 0;

            if (direction == 0)
            {
                zd = 1;
            }
            else if (direction == 1)
            {
                xd = -1;
            }
            else if (direction == 2)
            {
                zd = -1;
            }
            else if (direction == 3)
            {
                xd = 1;
            }

            int  i1    = (world.GetBlock(x - xd, y, z - zd).IsSolid ? 1 : 0) + (world.GetBlock(x - xd, y + 1, z - zd).IsSolid ? 1 : 0);
            int  j1    = (world.GetBlock(x + xd, y, z + zd).IsSolid ? 1 : 0) + (world.GetBlock(x + xd, y + 1, z + zd).IsSolid ? 1 : 0);
            bool flag  = world.GetBlock(x - xd, y, z - zd).Id == block.Id || world.GetBlock(x - xd, y + 1, z - zd).Id == block.Id;
            bool flag1 = world.GetBlock(x + xd, y, z + zd).Id == block.Id || world.GetBlock(x + xd, y + 1, z + zd).Id == block.Id;
            bool flag2 = false;

            if (flag && !flag1)
            {
                flag2 = true;
            }
            else if (j1 > i1)
            {
                flag2 = true;
            }

            if (!block.CanPlace(world, player, blockCoordinates, face))
            {
                return;
            }

            block.DoorHingeBit = flag2;

            // The upper door block, meta marks upper and
            // sets orientation based on adjacent blocks
            DoorBase blockUpper = (DoorBase)BlockFactory.GetBlockById(_blockId);

            blockUpper.Coordinates   = coordinates + Level.Up;
            blockUpper.Direction     = direction;
            blockUpper.UpperBlockBit = true;
            blockUpper.DoorHingeBit  = flag2;

            world.SetBlock(block);
            world.SetBlock(blockUpper);

            if (player.GameMode == GameMode.Survival)
            {
                var itemInHand = player.Inventory.GetItemInHand();
                itemInHand.Count--;
                player.Inventory.SetInventorySlot(player.Inventory.InHandSlot, itemInHand);
            }
        }
Пример #12
0
 public void setDoor(DoorBase door)
 {
     this.door            = door;
     this.agent.isStopped = true;
     this.agent.velocity  = Vector3.zero;
 }
Пример #13
0
 public override void markAsOpen(DoorBase door)
 {
     this.openState.quaternionValue = door.transform.localRotation;
 }
Пример #14
0
 public override void markAsOpen(DoorBase door)
 {
     this.closedState.vector3Value = door.transform.localPosition;
 }
Пример #15
0
 public abstract void markAsOpen(DoorBase door);
Пример #16
0
 public abstract void markAsClosed(DoorBase door);
Пример #17
0
 public override void markAsClosed(DoorBase door)
 {
     this.closedState.quaternionValue = door.transform.localRotation;
 }