Example #1
0
        public void SpawnArtifacts(SpellBookArtifact artifactEntry)
        {
            if (artifactEntry.Cost > Points)
            {
                return;
            }

            var playerScript = GetLastReader().Script;
            var spawnResult  = Spawn.ServerPrefab(dropPodPrefab, playerScript.WorldPos);

            if (spawnResult.Successful)
            {
                points -= artifactEntry.Cost;
                SoundManager.PlayNetworkedAtPos(summonItemSound, playerScript.WorldPos, sourceObj: playerScript.gameObject);

                var closetControl = spawnResult.GameObject.GetComponent <ClosetControl>();

                foreach (GameObject artifactPrefab in artifactEntry.Artifacts)
                {
                    spawnResult = Spawn.ServerPrefab(artifactPrefab);
                    if (spawnResult.Successful)
                    {
                        ObjectBehaviour artifactBehaviour = spawnResult.GameObject.GetComponent <ObjectBehaviour>();
                        closetControl.ServerAddInternalItem(artifactBehaviour);
                    }
                }
            }
        }
Example #2
0
        public void SpawnArtifacts(SpellBookArtifact artifactEntry)
        {
            if (artifactEntry.Cost > Points)
            {
                return;
            }

            var playerScript = netTab.LastInteractedPlayer().Player().Script;

            var spawnResult = Spawn.ServerPrefab(dropPodPrefab, playerScript.WorldPos);

            if (spawnResult.Successful)
            {
                points -= artifactEntry.Cost;

                var closetControl = spawnResult.GameObject.GetComponent <ClosetControl>();

                foreach (GameObject artifactPrefab in artifactEntry.Artifacts)
                {
                    spawnResult = Spawn.ServerPrefab(artifactPrefab);
                    if (spawnResult.Successful)
                    {
                        ObjectBehaviour artifactBehaviour = spawnResult.GameObject.GetComponent <ObjectBehaviour>();
                        closetControl.ServerAddInternalItem(artifactBehaviour);
                    }
                }
            }
        }
 private void SetArtifactValues(SpellBookArtifact artifactEntry)
 {
     spellLabel.SetValueServer(artifactEntry.Name);
     cooldownLabel.SetValueServer(default);