示例#1
0
        public void Dispense(GameObject objectPrefab, PipeLayer pipeLayer, Color pipeColor)
        {
            if (MachineOperating || securable.IsAnchored == false)
            {
                return;
            }

            this.RestartCoroutine(SetMachineOperating(), ref animationRoutine);
            SpawnResult spawnResult = Spawn.ServerPrefab(objectPrefab, objectBehaviour.AssumedWorldPositionServer());

            if (spawnResult.Successful)
            {
                spawnResult.GameObject.GetComponent <PipeItem>()?.SetColour(pipeColor);

                newPipe = new PipeObjectSettings
                {
                    pipeObject = spawnResult.GameObject,
                    pipeColor  = pipeColor
                };
            }
            else
            {
                Logger.LogError($"Failed to spawn an object from {name}! Is GUI_{name} missing reference to object prefab?",
                                Category.Pipes);
            }
        }
示例#2
0
 void SyncObjectProperties(PipeObjectSettings oldState, PipeObjectSettings newState)
 {
     newPipe = newState;
     newPipe.pipeObject.GetComponentInChildren <SpriteRenderer>().color = newPipe.pipeColor;
 }