Пример #1
0
 public void switchLane()
 {
     if (isServer) {
         ComputerLane newLane = computerLane == ComputerLane.LEFT ? ComputerLane.RIGHT : ComputerLane.LEFT;
         gameObject.GetComponent<Attack>().initiliseAttack();
         targetSelect = GetComponent<TargetSelect> ();
         Vector3 desiredPosition = transform.position;
         desiredPosition.z = newLane == ComputerLane.LEFT ? 210f : 90f;
         //work out the x if the screen we're switching on is not 0 and the number of screens in each lane is not the same
         int currentScreen = (int)transform.position.x / 100;
         if(currentScreen > 0 && GraniteNetworkManager.numberOfScreens_left != GraniteNetworkManager.numberOfScreens_right) {
             desiredPosition.x = (transform.position.x % 100) + ((newLane == ComputerLane.LEFT ? GraniteNetworkManager.numberOfScreens_left : GraniteNetworkManager.numberOfScreens_right) - 1) * 100;
         }
         gameObject.GetComponent<HeroMovement>().initialiseMovement(desiredPosition);
         targetSelect.InitialiseTargetSelect (team.GetTeamID(), desiredPosition);
         setComputerLane(newLane);
         SocketIOOutgoingEvents.PlayerSwitchLaneHandler(playerID , newLane);
     }
 }
Пример #2
0
    public void RpcResetGameObject(Vector3 spawnLocation, ComputerLane computerLane, Vector3 rotation)
    {
        active = true;
        gameObject.GetComponent<HeroMovement>().initialiseMovement(spawnLocation);
        if(isServer) gameObject.GetComponent<Attack>().initiliseAttack();

        if(isServer){
            // initialise targeting and movement
            targetSelect = GetComponent<TargetSelect>();
            targetSelect.InitialiseTargetSelect (team.GetTeamID(), spawnLocation);
        }
        gameObject.GetComponent<SynchronisedMovement>().ResetMovement(spawnLocation, rotation);
        //set Health to Max
        gameObject.GetComponent<Health>().InitialiseHealth(computerLane);
        gameObject.SetActive(active);
    }