Esempio n. 1
0
        void Start()
        {
            // Used to find "MothershipModule" or "LilGuyModule"
            // Thus, this script must be placed on the "Mothership" or "LilGuy" Game Object
            // This is brittle TODO BUCK (forces invisible name dependencies on object + module)
            module = GameObject.Find(gameObject.name + "Module").GetComponent <ShipModule>();

            moveBehavior  = GetComponent <IMoveable>();
            fuelContainer = GetComponentInChildren <ICargoHold>().getContainer(ResourceType.FUEL);
        }
Esempio n. 2
0
        public void engage(ShipModule module, Player.Player player)
        {
            player.transform.position = new Vector3(
                transform.position.x,
                transform.position.y,
                player.transform.position.z
                );                                                  // Move player to center of module and ensure they keep their original z coordinate

            player.GetComponent <SpriteRenderer>().enabled = false; // Player "gets in"

            module.canActivePlayerDisengage = false;                // activePlayer cannot disengage without help from other player
        }
Esempio n. 3
0
        private void moveHalfwayTowardCenter(Player.Player player, ShipModule module)
        {
            float halfwayX = (module.transform.position.x - player.transform.position.x) / 2;
            float newX     = player.transform.position.x + halfwayX;

            // Teleport player toward center of module and ensure they keep their original y & z coordinate
            // This HACK ensures the player is touching the module and hasnt slid past when engaging
            // and should be removed at some point TODO BUCK
            player.transform.position = new Vector3(
                newX,
                player.transform.position.y,
                player.transform.position.z
                );
        }
Esempio n. 4
0
 public void disengage(ShipModule module, Player.Player player)
 {
     // Do nothing
 }
Esempio n. 5
0
 public void engage(ShipModule module, Player.Player player)
 {
     moveHalfwayTowardCenter(player, module);
 }
Esempio n. 6
0
 public void disengage(ShipModule module, Player.Player player)
 {
     player.GetComponent <SpriteRenderer>().enabled = true;            // Player "gets out"
 }