示例#1
0
 public void SetTrajectoryAngle(float angle)
 {
     if (!IsLaunched)
     {
         angle  = ((int)Mathf.Round(angle / 10f)) * 10;             //round to the nearest 10
         angle %= 360;
         if (angle != TrajectoryAngle)
         {
             //redo position prediction
             Vector2   a    = GameManager.angleToVector(angle);
             LayerMask mask = 1 << LayerMask.NameToLayer("Letter") | 1 << LayerMask.NameToLayer("Walkable");
             List <PositionPrediction.RigidbodyStatusData> positions = PositionPrediction.predict(transform.position, a * displayVelocity, 0, 50, 0, true, gravityModifier, 0, sr.bounds.extents.x, mask);
             TrajectoryAngle = angle;
             for (int i = 5; i < positions.Count; i += 5)
             {
                 //Debug.DrawLine (positions [i].position, positions [i - 5].position, Color.blue, 1f);
                 int index = i / 5;
                 trail [index].SetActive(true);
                 trail [index].transform.position = positions [i].position;
             }
             for (int i = positions.Count; i < 50; i += 5)
             {
                 int index = i / 5;
                 trail [index].SetActive(false);
             }
         }
         ValidTrajectory = true;
     }
 }
 // Use this for initialization
 public SoloEngage(Ship inShip)
 {
     ship = inShip;
     if (ship == null || ship.target == null)
     {
         return;
     }
     leader = inShip.getFleetLeader();
     predictTarget = new PositionPrediction(inShip);
     RandomPsuedoUpVector();
     if(ship.photonView.isMine)
         ship.photonView.RPC("SoloEngageRPC", PhotonTargets.Others, psuedoUpVector, ship.target.GetComponent<PhotonView>().viewID);
 }
    public TeamEngage(Ship inShip)
    {
        ship = inShip;
        leader = inShip.getFleetLeader();

        if (ship != leader)
            ship.SetTargetTransform(leader.GetTarget());

        predictTarget = new PositionPrediction(inShip);

        if (leader.target == null)
        {
            LeaderChecks();
        }

        if(ship.photonView.isMine && leader.target != null)
        {
            RandomPsuedoUpVector();
            ship.photonView.RPC("TeamEngageRPC", PhotonTargets.Others, psuedoUpVector, ship.fleetLeader.target.GetComponent<PhotonView>().viewID);
        }
    }
 // Use this for initialization
 public MultiSoloEngage(Ship inShip)
 {
     ship = inShip;
     leader = inShip.getFleetLeader();
     predictTarget = new PositionPrediction(inShip);
 }