Пример #1
0
        public void CreateCharacter(PlayerSessionData psData)
        {
            if (!initialized)
            {
                return;
            }
            CharController newChar = GameObject.Instantiate(characterPrefab, spawnLocations[psData.playerIndex % spawnLocations.Count]);

            newChar.ship = shipMovement;
            newChar.outsideBehaviour.shipEjectSystem = shipEjectSystem;
            newChar.transform.parent = charactersRoot;
            newChar.Initialize(psData, spawnFloors[psData.playerIndex % spawnFloors.Count]);
            /* Attach Tool */
            if (psData.charToolType != CharToolType.None)
            {
                CharTool tool = charToolFactory.CreateCharTool(psData.charToolType);
                newChar.EquipTool(tool);
            }
            /* Cameras */
            contextCams[psData.playerIndex].SetFollowTarget(newChar.transform);
            contextCams[psData.playerIndex].Activate();
            CamZone charGameplayCamZone = gameplayCamZone.Copy();

            charGameplayCamZone.trans = newChar.transform;
            gameplaySet.camZones.Add(charGameplayCamZone);
            CamZone charCharactersCamZone = characterCamZone.Copy();

            charCharactersCamZone.trans = newChar.transform;
            charactersSet.camZones.Add(charCharactersCamZone);

            playerCharacters.Add(newChar);
        }
Пример #2
0
 public void EquipTool(CharTool charTool)
 {
     if (hasEquipedTool)
     {
         //Drop tool
         equipedTool.Unequip();
     }
     charTool.EquipToCharacter(this);
     hasEquipedTool = true;
     equipedTool    = charTool;
     equipedTool.transform.SetParent(equipedToolRoot, false);
     equipedTool.transform.localPosition = Vector3.zero;
 }