Beispiel #1
0
        //OnBoat和OffBoat,负责操控船的数据结构,同时负责管理移动
        public void OnBoat(ICharacterController element)
        {
            if (this.boatFull())
            {
                return;
            }

            if (boatStatus == 0)//从from向to,front为前
            {
                if (frontCharacter == null)
                {
                    //Debug.Log("from->to:front element in boat");
                    frontCharacter = element;
                    element.character.transform.parent = boat.transform;
                    element.moveOnBoat(boat.transform.position, boatStatus, front);
                }
                else
                {
                    //Debug.Log("from->to:back element in boat");
                    backCharacter = element;
                    element.character.transform.parent = boat.transform;
                    element.moveOnBoat(boat.transform.position, boatStatus, back);
                }
            }
            else // 从to开向from,back为前
            {
                if (backCharacter == null)
                {
                    //Debug.Log("to->from:back element in boat");
                    backCharacter = element;
                    element.character.transform.parent = boat.transform;
                    element.moveOnBoat(boat.transform.position, boatStatus, back);
                }
                else
                {
                    //Debug.Log("to->from:front element in boat");
                    frontCharacter = element;
                    element.character.transform.parent = boat.transform;
                    element.moveOnBoat(boat.transform.position, boatStatus, front);
                }
            }
        }
Beispiel #2
0
        //OnBoat和OffBoat,负责操控船的数据结构,同时负责管理移动
        public void OnBoat(ICharacterController element)
        {
            if (this.boatFull())
            {
                return;
            }

            if (boatStatus == 0)//从from向to,front为前
            {
                if (frontCharacter == null)
                {
                    frontCharacter = element;
                    element.character.transform.parent = boat.transform;
                    element.moveOnBoat(boat.transform.position, boatStatus, front);
                }
                else
                {
                    backCharacter = element;
                    element.character.transform.parent = boat.transform;
                    element.moveOnBoat(boat.transform.position, boatStatus, back);
                }
            }
            else // 从to开向from,back为前
            {
                if (backCharacter == null)
                {
                    backCharacter = element;
                    element.character.transform.parent = boat.transform;
                    element.moveOnBoat(boat.transform.position, boatStatus, back);
                }
                else
                {
                    frontCharacter = element;
                    element.character.transform.parent = boat.transform;
                    element.moveOnBoat(boat.transform.position, boatStatus, front);
                }
            }
        }