Ejemplo n.º 1
0
 public void CycleTarget(RagdollHand interactor = null, bool inc = true)
 {
     if (inc)
     {
         currentTarget = (currentTarget >= module.reinforcements.Count - 1) ? 0 : currentTarget + 1;
     }
     else
     {
         currentTarget = (currentTarget <= 0) ? module.reinforcements.Count - 1 : currentTarget - 1;
     }
     reinforcementData = module.reinforcements[currentTarget];
     creatureTable     = Catalog.GetData <CreatureTable>(reinforcementData.creatureTable, true);
     SetGraphic();
     SetColour();
     if (interactor)
     {
         Utils.PlayHaptic(interactor.side == Side.Left, interactor.side == Side.Right, Utils.HapticIntensity.Minor);
     }
     useSound.clip = module.useSoundAsset.PickAudioClip();
     useSound.Play();
 }
Ejemplo n.º 2
0
        protected void Awake()
        {
            item   = GetComponent <Item>();
            module = item.data.GetModule <ItemModuleComlink>();

            item.OnHeldActionEvent += OnHeldAction;
            item.OnGrabEvent       += OnGrabEvent;
            item.OnUngrabEvent     += OnUngrabEvent;
            item.OnSnapEvent       += OnSnapEvent;

            idleSound  = item.GetCustomReference("IdleSound").GetComponent <AudioSource>();
            pingSound  = item.GetCustomReference("PingSound").GetComponent <AudioSource>();
            startSound = item.GetCustomReference("StartSound").GetComponent <AudioSource>();
            stopSound  = item.GetCustomReference("StopSound").GetComponent <AudioSource>();
            useSound   = item.GetCustomReference("UseSound").GetComponent <AudioSource>();

            hologram      = item.GetCustomReference("Hologram").gameObject;
            hologramLight = item.GetCustomReference("HologramLight").GetComponent <MeshRenderer>();
            hologramLogo  = item.GetCustomReference("HologramLogo").GetComponent <MeshRenderer>();
            light         = item.GetCustomReference("Light").GetComponent <Light>();
            text          = item.GetCustomReference("Text").GetComponent <Text>();
            materials     = item.GetCustomReference("Materials").GetComponent <MeshRenderer>().materials;

            hologram.SetActive(false);
            spawnLocations = new List <SpawnLocation>(FindObjectsOfType <SpawnLocation>());

            item.TryGetSavedValue("faction", out string tempFaction);
            item.TryGetSavedValue("target", out string tempTarget);
            int.TryParse(tempFaction, out currentFaction);
            int.TryParse(tempTarget, out currentTarget);

            factionData       = module.factions[currentFaction];
            reinforcementData = module.reinforcements[currentTarget];
            creatureTable     = Catalog.GetData <CreatureTable>(reinforcementData.creatureTable, true);
            SetGraphic();
            SetColour();
        }