void Start()
    {
        Active = false;

        eventManager       = GameObject.Find("EventManager").GetComponent <EventManager>();
        jumpgateController = GetComponent <JumpgateController>();
    }
Ejemplo n.º 2
0
    void OnTriggerEnter(Collider Other)
    {
        string tag = Other.gameObject.tag;

        switch (tag)
        {
        case "Station":
            StationController sc = Other.GetComponent <StationController>();
            PlayerController.playerController.stationID = sc.stationID;
            break;

        case "Jumpgate":
            JumpgateController jc = Other.GetComponent <JumpgateController>();
            PlayerController.playerController.jumpgateID = jc.jumpgateID;
            break;
        }

        //Activate button
        Messenger.Broadcast("PlayerStructureProximity", tag);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Get an NPC from the pool, place it, and activate it.
    /// </summary>
    /// <returns>IEnumerable: Null, for the coroutine</returns>
    /// <remarks>
    /// <para>
    /// Once it's determined that we need to spawn an NPC, we pull one from
    /// the inactive NPC pool to use.
    /// </para>
    /// <para>
    /// Each merchant NPC spawns in at a jumpgate's EGRESS point, which is an
    /// invisible GO orbiting the jumpgate outside of the jumpgate's trigger.
    /// This is also where players will spawn in when they enter the scene.
    /// </para>
    /// <para>
    /// Finally, we assign some data to the NPC's NPC component for tracking
    /// purposes, and set the Active flag to TRUE.
    /// </para>
    /// </remarks>
    IEnumerator SpawnMerchantNPC()
    {
        GameObject newMerchant = GetMerchantFromPool();

        if (newMerchant != null)
        {
            //Get demographic component
            NPC npcComponent = newMerchant.GetComponent <NPC>();

            //Assign placement point
            GameObject         startGate   = sc.GetRandomJumpgate();
            JumpgateController jgc         = startGate.GetComponent <JumpgateController>();
            GameObject         egressPoint = jgc.egressPoint;

            //Update demographic, place object, activate
            npcComponent.currentSector     = sc.sectorID;
            newMerchant.transform.position = egressPoint.transform.position;
            newMerchant.SetActive(true);
        }

        yield return(null);
    }
 // Use this for initialization
 void Start()
 {
     controller         = GetComponent <CharacterController>();
     jumpgateController = GameObject.Find("Jumpgate").GetComponent <JumpgateController>();
 }