コード例 #1
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     squadron.SabPowers.SabotagePower.FullDefense =
         IsActive()
         &&
         MathConts.ProcessChance(ChanceValue + ComboEffectValue, squadron.Inspiration, GetName()) ? squadron.SabPowers.SabotagePower.Total : ZERO;
 }
コード例 #2
0
 /// <param name="pname"> The ships name </param>
 /// <param name="pposition"> The initial position of the ship </param>
 /// <param name="protation"> The initial rotation of the ship</param>
 public EDShip(string pname, Vector3 pposition, Vector3 protation)
 {
     name     = pname;
     Position = pposition;
     Rotation = protation;
     _squad   = Squadron.default_squadron;
 }
コード例 #3
0
 private void InstantiateMonsters(Squadron squadron, GameObject defPos, GameObject atkPos, GameObject sabPos, bool playerEnemy)
 {
     defPos.transform.rotation = squadron.DefMonster.MonsterName.Equals("BigBoss") ? playerEnemy ? plBigBoss.transform.rotation : enBigBoss.transform.rotation : defPos.transform.rotation;
     GenerateMonsterByPosition(squadron.DefMonster, defPos.transform);
     GenerateMonsterByPosition(squadron.AtkMonster, atkPos.transform);
     GenerateMonsterByPosition(squadron.SabMonster, sabPos.transform);
 }
コード例 #4
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     squadron.AtkPowers.AttackPower.CriticalHit =
         IsActive()
         &&
         MathConts.ProcessChance(ChanceValue, squadron.Inspiration, GetName()) ? EffectValue + ComboEffectValue : ZERO;
 }
コード例 #5
0
 public override void Update(Squadron squadron)
 {
     foreach (Ship ship in squadron.ships)
     {
         ship.GetComponent<AIShipController>().MoveTowards(followSquadron.icon.transform.position);
     }
 }
コード例 #6
0
    //Finds the closest target to try and attack
    public void FindEnemyTarget()
    {
        enemySquadron = FindEnemySquadron(); //locate the closest enemy squadron
        if (enemySquadron != null)
        {
            enemyObject = FindEnemyShip(enemySquadron); //set the enemy object to the closest ship in the enemy squadron

            if (enemyObject == null)                    //if there is no target found
            {
                if (!friendly)
                {
                    enemyObject = MainController.instance.playerShipObject;            //if federation ship, target player
                }
                return;
            }
            Rigidbody2D playerRigid = MainController.instance.playerRigidbody2D;      //used for player position
            enemyRigid = enemyObject.GetComponent <Rigidbody2D>();                    //used for getting currently selected enemy position
            float playerDist = Vector2.Distance(playerRigid.position, this.position); //gets the player's distance from the squadron
            float enemyDist  = Vector2.Distance(enemyRigid.position, this.position);  //gets the existing enemy's distance from the squadron

            if (playerDist < enemyDist && friendly == false)                          //if federation ship, target the friendly ship
            {
                enemySquadron = null;
                enemyObject   = MainController.instance.playerShipObject; //if player closer, attack player
            }
        }
        else
        {
            if (friendly == false)
            {
                enemyObject = MainController.instance.playerShipObject;                    //if the enemy squadron is not found, try attack player
            }
        }
    }
コード例 #7
0
ファイル: WaveEvent.cs プロジェクト: mike1072/GGJ2020
 public static WaveEvent SpawnSquadron(Squadron squadron)
 {
     return(new WaveEvent
     {
         _squadron = squadron
     });
 }
コード例 #8
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     squadron.SabPowers.SabotagePower.DecreaseEnemyDivergeDamage =
         IsActive()
         &&
         MathConts.ProcessChance(ChanceValue, squadron.Inspiration, GetName()) ? EffectValue + ComboEffectValue : ZERO;
 }
コード例 #9
0
    void Awake()
    {
        Instance = this;
        SetDifficulty("Easy");
        SetEnemyFaction("Test");

        PlayerFleets = new List <Fleet> ();
        Fleet    fleet0    = new Fleet();
        Squadron squadron1 = new Squadron();

        /*ShipFitting fighter = new ShipFitting (new FighterTestStats(),
         *                                     new string[2]{"SmallLaserTest","Overcharge"},
         *                                                                              new string[1]{"ReactiveArmor"});
         * ShipFitting fregate = new ShipFitting (new FregateTestStats(),
         *                                     new string[1]{"LargeLaserTest"},
         *                                                                              new string[1]{"ReactiveArmor"});
         */
        //fighter.SetEquipment (0, new SmallLaserTest());
        //fregate.SetEquipment (0, new LargeLaserTest());

        /*squadron1.SetShip (0, "LargePlayerShipTest2");
         * squadron1.SetShip (1, "SmallPlayerShipTest");
         * squadron1.SetShip (2, "SmallPlayerShipTest");
         * squadron1.SetShip (3, "SmallPlayerShipTest");
         *
         * fleet0.SetSquadron (0, squadron1);
         * /*fleet0.SetSquadron (1, squadron1);
         * fleet0.SetSquadron (2, squadron1);
         * fleet0.SetSquadron (3, squadron1);*/

        PlayerFleets.Add(fleet0);
        FleetSelected = 0;
    }
コード例 #10
0
 void Start()
 {
     myVars      = GetComponent <Squadron>();
     healthMgr   = GetComponent <EnemyHealthManager>();
     powerupMgr  = GetComponent <FodderPowerupMgr>();
     deathEffect = myVars.DeathEffect;
 }
コード例 #11
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     squadron.AtkPowers.AttackPower.DoubleStrike =
         IsActive()
         &&
         MathConts.ProcessChance(ChanceValue + ComboEffectValue, squadron.Inspiration, GetName());
 }
コード例 #12
0
    public override void Update(Squadron squadron)
    {
        if (targetSquadron != null)
        {
            foreach (Ship ship in squadron.ships)
            {
                AIShipController aiShipController = ship.gameObject.GetComponent<AIShipController>();

                if (aiShipController.currentState is AttackState)
                {
                    if (aiShipController.Target == null)
                    {
                        AttackState attackState = (AttackState)aiShipController.currentState;
                        Ship targetShip = GetTarget(ship);
                        if (targetShip != null)
                        {
                            attackState.SetTarget(targetShip.gameObject);
                        }
                    }
                }
                else
                {
                    aiShipController.SetBehaviour(new AttackState(GetTarget(ship).gameObject));
                }
            }

        }
        else
        {
            squadron.SetState(new SquadronIdleState());
        }
    }
コード例 #13
0
ファイル: FleetAIController.cs プロジェクト: sean-h/spacegame
    //Makes the parameter squadron attack the enemy closest to the squadron.
    void AttackNearestEnemy(Squadron squadron)
    {
        if (squadron.engagePriority.Count > 0) //squadron has a priority list?
        {
            foreach (Squadron s in enemyFleet.squadrons)
            {
                if (s.shipClass == squadron.engagePriority[0])
                {
                    squadron.SetState(new SquadronAttackState(s));
                    return;
                }
            }
        }

        if (enemyFleet.squadrons.Count > 0)
        {
            Squadron closestEnemySquadron = enemyFleet.squadrons[0];
            float distance = Vector3.Distance(squadron.transform.position, closestEnemySquadron.transform.position);

            for (int i = 1; i < enemyFleet.squadrons.Count; i++)
            {
                float d = Vector3.Distance(squadron.transform.position, enemyFleet.squadrons[i].transform.position);

                if (d < distance)
                {
                    closestEnemySquadron =     enemyFleet.squadrons[i];
                    distance = d;
                }
            }

            squadron.SetState(new SquadronAttackState(closestEnemySquadron));
        }
    }
コード例 #14
0
 public override void Clear(Squadron squadron)
 {
     foreach (Ship ship in squadron.ships)
     {
         ship.GetComponent<AIShipController>().SetBehaviour(new IdleState());
     }
 }
コード例 #15
0
    public void SpawnEnemyFleet()
    {
        string          factionName       = MissionInfo2.Instance.GetEnemyFaction();
        int             difficulty        = MissionInfo2.Instance.GetDifficulty();
        List <Squadron> enemySquadrons    = FactionManager.Instance.GetFactionSquadrons(factionName, difficulty);
        int             numberOfSquadrons = enemySquadrons.Count;
        List <Cluster>  spawnCluster      = Grid2.Instance.GetEnemySpawnClusters();

        foreach (Cluster cluster in spawnCluster)
        {
            Squadron randomSquadron = enemySquadrons[Random.Range(0, numberOfSquadrons)];
            if (randomSquadron != null && randomSquadron.GetLargeShip() != null)
            {
                Tile shipSpawnTile = cluster.GetClusterTiles()[2, 1];
                EnemyShipSpawner(randomSquadron.GetLargeShip(), shipSpawnTile);
            }

            for (int smallShipNumber = 0; smallShipNumber < 3; smallShipNumber++)
            {
                if (randomSquadron != null && randomSquadron.GetSmallShip(smallShipNumber) != null)
                {
                    Tile shipSpawnTile = cluster.GetClusterTiles()[2 + smallShipNumber, 4];
                    EnemyShipSpawner(randomSquadron.GetSmallShip(smallShipNumber), shipSpawnTile);
                }
            }
        }
    }
コード例 #16
0
ファイル: SquadronMoveState.cs プロジェクト: sean-h/spacegame
    public override void Update(Squadron squadron)
    {
        squadron.faceDirection = (moveToposition - squadron.icon.transform.position).normalized;

        int counter = 0;
        foreach (Ship ship in squadron.ships)
        {
            AIShipController shipController = ship.gameObject.GetComponent<AIShipController>();

            if (!(shipController.currentState is MoveState || shipController.currentState is FlyAround))
            {
                Vector3 position = squadron.squadronFormation.GetPosition(moveToposition, counter);
                shipController.SetBehaviour(new MoveState(position));

                shipController.FormationPosition = position;
            }
            counter++;
        }

        if (lineObject == null)
        {
            lineObject = new GameObject("MovementLine");
            lineObject.AddComponent<LineRenderer>();

            lineRenderer = lineObject.GetComponent<LineRenderer>();
            lineRenderer.SetVertexCount(2);
            lineRenderer.SetPosition(0, moveToposition);

        }

        lineRenderer.SetPosition(1, squadron.icon.transform.position);
    }
コード例 #17
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && !EffectApplied)
     {
         squadron.DefPowers.DefensePower.CriticalHitResistance = EffectValue + ComboEffectValue;
         EffectApplied = true;
     }
 }
コード例 #18
0
 public override void Update(Squadron squadron)
 {
     //TODO: MOVE TO START FUNCTION
     foreach (Ship ship in squadron.ships)
     {
         ship.GetComponent<AIShipController>().SetBehaviour(new MoveForwardState());
     }
 }
コード例 #19
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && !EffectApplied)
     {
         squadron.SabPowers.SabotagePower.Bonus += MathConts.GetPercentageOf(squadron.SabPowers.SabotagePower.Base, (EffectValue + ComboEffectValue));
         EffectApplied = true;
     }
 }
コード例 #20
0
    /// <summary> Should be called, when the squad-dropdown is changed </summary>
    public void SquadChanged()
    {
        var current = _current_ship;

        _current_squad = EditorGeneral.squadron_list [squadselect.value];
        current.Squad  = _current_squad;
        _current_ship  = current;
    }
コード例 #21
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && !EffectApplied)
     {
         squadron.DefPowers.DefensePower.DivergeDamageToDefense = EffectValue + ComboEffectValue;
         EffectApplied = true;
     }
 }
コード例 #22
0
        public IActionResult DeleteSquadron(string Name)
        {
            Squadron dbentry = context.Squadrons.FirstOrDefault(p => p.Name == Name);

            context.deleteEntry(dbentry);

            return(RedirectToAction(nameof(Home)));
        }
コード例 #23
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && !EffectApplied)
     {
         squadron.SabPowers.SabotagePower.DecreaseEnemyCriticalResistance = EffectValue + ComboEffectValue;
         EffectApplied = true;
     }
 }
コード例 #24
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && squadron.SabPowers.HealthPower.CurrentHp > 0)
     {
         squadron.SabPowers.HealthPower.RestoreLife(
             MathConts.GetPercentageOf(squadron.SabPowers.HealthPower.MaxHp, EffectValue + ComboEffectValue));
     }
 }
コード例 #25
0
 public FightStages(Squadron squadron, AbilitiesContainer container, bool isPlayer)
 {
     IsPlayer           = isPlayer;
     Squad              = squadron;
     Attack             = new Attack(squadron);
     Defense            = new Defense(squadron);
     AbilitiesContainer = container;
     AbilitiesContainer.ApplyEffectsByActionType(Squad, ActionType.PASSIVE);
 }
コード例 #26
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && MathConts.ProcessChance(ChanceValue, squadron.Inspiration, GetName()))
     {
         squadron.AtkPowers.AttackPower.OnTurnBonusAttack = MathConts.GetPercentageOf(squadron.AtkPowers.AttackPower.Total, EffectValue + ComboEffectValue);
         squadron.DefPowers.AttackPower.OnTurnBonusAttack = MathConts.GetPercentageOf(squadron.DefPowers.AttackPower.Total, EffectValue + ComboEffectValue);
         squadron.SabPowers.AttackPower.OnTurnBonusAttack = MathConts.GetPercentageOf(squadron.SabPowers.SabotagePower.Total / 2, EffectValue + ComboEffectValue);
     }
 }
コード例 #27
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && !EffectApplied)
     {
         squadron.AtkPowers.HealthPower.BonusHp =
             MathConts.GetPercentageOf(squadron.AtkPowers.HealthPower.MaxHp, EffectValue + ComboEffectValue);
         EffectApplied = true;
     }
 }
コード例 #28
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && !EffectApplied && MathConts.ProcessChance(ChanceValue, squadron.Inspiration, GetName()))
     {
         squadron.AtkPowers.AttackPower.PassiveDamage =
             MathConts.GetPercentageOf(squadron.AtkPowers.AttackPower.Total, EffectValue + ComboEffectValue);
         EffectApplied = true;
     }
 }
コード例 #29
0
 public void StartEnemyHPs(Squadron squadron)
 {
     enAtkHP = squadron.AtkPowers.HealthPower.MaxHp;
     enDefHP = squadron.DefPowers.HealthPower.MaxHp;
     enSabHP = squadron.SabPowers.HealthPower.MaxHp;
     ImagesFillers.AddSquadronMonsterHeads(enAtkIcon, enDefIcon, enSabIcon, squadron);
     StartSquadHPs(enAtkSlider, enDefSlider, enSabSlider, enAtkHP, enDefHP, enSabHP);
     StartGradient(enAtkGradient, enDefGradient, enSabGradient, enAtkFill, enDefFill, enSabFill);
     UpdateEnemyMonstersSubtitles(enAtkHP, enDefHP, enSabHP);
 }
コード例 #30
0
 public void StartPlayerHPs(Squadron squadron)
 {
     plAtkHP = squadron.AtkPowers.HealthPower.MaxHp;
     plDefHP = squadron.DefPowers.HealthPower.MaxHp;
     plSabHP = squadron.SabPowers.HealthPower.MaxHp;
     ImagesFillers.AddSquadronMonsterHeads(plAtkIcon, plDefIcon, plSabIcon, squadron);
     StartSquadHPs(plAtkSlider, plDefSlider, plSabSlider, plAtkHP, plDefHP, plSabHP);
     StartGradient(plAtkGradient, plDefGradient, plSabGradient, plAtkFill, plDefFill, plSabFill);
     UpdatePlayerMonstersSubtitles(plAtkHP, plDefHP, plSabHP);
 }
コード例 #31
0
 public override void ApplyPrimaryEffect(Squadron squadron)
 {
     if (IsActive() && !EffectApplied && squadron.SabPowers.HealthPower.CurrentHp == 0)
     {
         if (MathConts.ProcessChance(ChanceValue, squadron.Inspiration, GetName()))
         {
             squadron.SabPowers.HealthPower.Revive(MathConts.GetPercentageOf(squadron.SabPowers.HealthPower.MaxHp, (EffectValue + ComboEffectValue)));
         }
         EffectApplied = true;
     }
 }
コード例 #32
0
 public override void ApplyPrimaryEffect(Squadron squad)
 {
     squad.DefPowers.DefensePower.StopPassiveDamage =
         IsActive()
         &&
         MathConts.ProcessChance(ChanceValue, squad.Inspiration, GetName())
             ?
         (EffectValue + ComboEffectValue)
             :
         ZERO;
 }
コード例 #33
0
 private void TurnOptionsOff()
 {
     ToggleButtons(false);
     Exit.SetActive(false);
     Definitions.SetActive(false);
     Bestiary.SetActive(false);
     Player.SetActive(false);
     Squadron.SetActive(false);
     Abilities.SetActive(false);
     TitleHelper.SetActive(false);
 }
コード例 #34
0
ファイル: MainWindow.xaml.cs プロジェクト: apetzak/SpaceCadet
 public void SpawnEnemies()
 {
     if (Enemies.Count < 4)
     {
         Squadron s = new Squadron();
         Squadrons.Add(s);
         foreach (Enemy e in s.Enemies)
         {
             Enemies.Add(e);
         }
     }
 }
コード例 #35
0
    public override void Update(Squadron squadron)
    {
        foreach (Ship ship in squadron.ships)
        {
            AIShipController aiShipController = ship.GetComponent<AIShipController>();

            if (!(aiShipController.currentState is FollowState))
            {
                aiShipController.SetBehaviour(new FollowState(_shipLeader.gameObject));
            }
        }
    }
コード例 #36
0
ファイル: Fleet.cs プロジェクト: MerourRonan/SpaceTactic
 public void SetSquadron(int number, Squadron squadron)
 {
     if (number >= 0 && number < 4)
     {
         m_Squadrons[number] = squadron;
     }
     else
     {
         Debug.Log("ERROR : squadron number to high");
     }
     //m_Squadrons [number] = squadron;
 }
コード例 #37
0
 public IActionResult ModifySquadron(Squadron entry)
 {
     if (ModelState.IsValid)
     {
         context.saveEntry(entry);
         return(RedirectToAction(nameof(CongratulationsEntry)));
     }
     else
     {
         // there is something wrong with the data values
         return(View(entry));
     }
 }
コード例 #38
0
ファイル: SquadronMoveState.cs プロジェクト: sean-h/spacegame
    public override void Clear(Squadron squadron)
    {
        foreach (Ship ship in squadron.ships)
        {
            AIShipController aiShipController = ship.GetComponent<AIShipController>();

            aiShipController.SetBehaviour(new IdleState());
        }

        GameObject.Destroy(lineObject);
        lineRenderer = null;

        base.Clear (squadron);
    }
コード例 #39
0
    public void SelectSquadron(Squadron squadron)
    {
        DeselectSquadron(); //deselect old squadron
        squadron.Select();
        selectedSquadron = squadron;

        //create new movement widget
        GameObject movementWidgetObj =
            (GameObject)Instantiate(movementWidgetPrefab, squadron.transform.position, Quaternion.identity);

        movementWidget = movementWidgetObj.GetComponent<MovementWidget>();
        movementWidget.SetObjectToMove(squadron.gameObject);

        movementWidget.SetCamera(cam);
    }
コード例 #40
0
    public override void Update(Squadron squadron)
    {
        float distanceToGuardSquadron = Vector3.Distance(squadron.icon.transform.position, guardSquadron.icon.transform.position);

        if (distanceToGuardSquadron > separationDistance)
        {
            Debug.Log("MOVE TO SQUADRON");

            foreach (Ship ship in squadron.ships)
            {
                ship.GetComponent<AIShipController>().SetBehaviour(new MoveState(guardSquadron.icon.transform.position));
            }
        }

        base.Update(squadron);
    }
コード例 #41
0
 public SquadronFormationWedge(Squadron squadron)
 {
     this.squadron = squadron;
 }
コード例 #42
0
 public SquadronAttackState(Squadron target)
 {
     targetSquadron = target;
 }
コード例 #43
0
 public void UpdateFormation(Squadron squadron)
 {
 }
コード例 #44
0
 public override void Clear(Squadron squadron)
 {
 }
コード例 #45
0
 public SquadronFollowState(Squadron followSquadron)
 {
     this.followSquadron = followSquadron;
 }
コード例 #46
0
ファイル: Fleet.cs プロジェクト: sean-h/spacegame
    void SquadronDestroyed(Squadron squadron)
    {
        squadrons.Remove(squadron);
        squadron.enabled = false;

        if (squadrons.Count <= 0)
        {
            //TODO: Implement
            fleetDestroyed(this);
        }
    }
コード例 #47
0
 public SquadronGuardState(Squadron guardSquadron)
 {
     Debug.Log("GUARD COMMAND ISSUED");
     this.guardSquadron = guardSquadron;
 }
コード例 #48
0
ファイル: SquadronState.cs プロジェクト: sean-h/spacegame
 public virtual void Clear(Squadron squadron)
 {
 }
コード例 #49
0
ファイル: ControlModeRTS.cs プロジェクト: sean-h/spacegame
    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            DeselectSquadrons();
            _selectedAction = -1;
        }

        if ((Input.mousePosition.y < Screen.height - 200) && (Input.mousePosition.x < Screen.width - 200))
        {
            if (Input.GetButtonDown("Fire1"))
            {
                switch (_selectedAction)
                {
                case -1: //nothing selected
                    DeselectSquadrons();
                    if (_hoverSquadron != null)
                    {
                        SelectSquadron(_hoverSquadron);
                    }
                    break;
                case 0: //move
                    MoveCommand();
                    _selectedAction = -1;
                    break;
                case 1: //attack
                    AttackCommand();
                    _selectedAction = -1;
                    break;
                case 2: //guard
                    GuardCommand();
                    _selectedAction = -1;
                    break;
                case 3: //halt
                     //do nothing, cannot be selected
                    break;
                }
            }

        }

        if (Input.GetButtonDown("Fire2"))
        {
            if (!AttackCommand())
            {
                MoveCommand();
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            if (Input.GetKey(KeyCode.LeftShift))
            {
                AssignControlGroup(selectedSquadrons, 1);
            }
            else
            {
                SelectControlGroup(1);
            }
        }
        if (Input.GetKey(KeyCode.LeftShift))
        {
            if (Input.GetKeyDown(KeyCode.LeftControl))
            {
                AssignControlGroup(selectedSquadrons, 2);
            }
            else
            {
                SelectControlGroup(2);
            }
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {

        }

        //movement plane rotation
        if (movementPlane.activeInHierarchy == true)
        {
            Ray ray = activeCamera.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100000, 1 << LayerMask.NameToLayer("MovementPlane")))
            {
                movementPlane.transform.position = hit.point;

                if (selectedSquadrons.Count > 0)
                {
                    _movementDistance = Vector3.Distance(selectedSquadrons[0].icon.transform.position, hit.point);
                    Debug.DrawLine(selectedSquadrons[0].icon.transform.position, hit.point);
                    Vector3 dropDownPoint = new Vector3(hit.point.x, selectedSquadrons[0].icon.transform.position.y, hit.point.z);
                    Debug.DrawLine(hit.point, dropDownPoint);
                }
            }

            //flip movement plane towards camera (1 is used for comparisons to account for float accuracy)
            if (activeCamera.transform.position.y < movementPlane.transform.position.y && movementPlane.transform.rotation.eulerAngles.z <= 1)
            {
                if (Input.GetKey(KeyCode.Tab))
                {

                }
                else
                {
                    movementPlane.transform.rotation = Quaternion.LookRotation(new Vector3(1, 0, 0), new Vector3(0, -1, 0));
                }
            }
            else if (activeCamera.transform.position.y > movementPlane.transform.position.y && movementPlane.transform.rotation.eulerAngles.z > 1)
            {
                if (Input.GetKey(KeyCode.Tab))
                {

                }
                else
                {
                    movementPlane.transform.rotation = Quaternion.LookRotation(new Vector3(1, 0, 0), new Vector3(0, 1, 0));
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            movementPlane.transform.rotation = Quaternion.LookRotation(new Vector3(0, 1, 0));
            _movementPlaneIsVertical = true;
        }
        if (Input.GetKeyUp(KeyCode.P))
        {
            movementPlane.transform.rotation = Quaternion.LookRotation(new Vector3(1, 0, 0), new Vector3(0, 1, 0));
            _movementPlaneIsVertical = false;
        }

        //selection sphere
        Ray ray2 = activeCamera.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit2;
        if (Physics.Raycast(ray2, out hit2, 10000, 1 << LayerMask.NameToLayer("Selectable")))
        {
            SelectionSphere selectionSphere = hit2.collider.gameObject.GetComponent<SelectionSphere>();
            Squadron squadron = selectionSphere.GetParentSquadron();

            if (squadron != _hoverSquadron)
            {
                if (_hoverSquadron != null)
                {
                    _hoverSquadron.OnHoverExit();
                }
                _hoverSquadron = squadron;
                _hoverSquadron.OnHoverEnter();
            }
        }
        else
        {
            if (_hoverSquadron != null)
            {
                if (!selectedSquadrons.Contains(_hoverSquadron))
                {
                    _hoverSquadron.OnHoverExit();
                }
                _hoverSquadron = null;
            }
        }

        if (Input.GetButtonDown("ToggleCamera"))
        {
            _followCamera.gameObject.SetActive(false);
            _RTSCamera.gameObject.SetActive(true);
            activeCamera = _RTSCamera.camera;
        }
    }
コード例 #50
0
ファイル: ControlModeRTS.cs プロジェクト: sean-h/spacegame
    public void SelectSquadron(Squadron squadron)
    {
        //fixes double click selections
        squadron.OnHoverEnter();

        if (!selectedSquadrons.Contains(squadron))
        {
            selectedSquadrons.Add(squadron);
        }
        movementPlane.SetActive(true);
    }
コード例 #51
0
ファイル: SquadronIdleState.cs プロジェクト: sean-h/spacegame
 public override void Update(Squadron squadron)
 {
 }
コード例 #52
0
ファイル: SquadronState.cs プロジェクト: sean-h/spacegame
 public virtual void Update(Squadron squadron)
 {
 }
コード例 #53
0
ファイル: Player.cs プロジェクト: sean-h/spacegame
 private void SelectSquadron(Squadron squadron)
 {
     if (setupController.enabled)
     {
         setupController.SelectSquadron(squadron);
     }
     else
     {
         _controlModeRTS.SelectSquadron(squadron);
     }
 }
コード例 #54
0
 public override void Clear(Squadron squadron)
 {
     base.Clear(squadron);
 }
コード例 #55
0
 public void MoveSquadronTo(Squadron squadron, Vector3 position)
 {
     squadron.transform.position = position;
 }
コード例 #56
0
 public SquadronFormationLine(Squadron squadron)
 {
     this.squadron = squadron;
     UpdateFormation(squadron);
 }
コード例 #57
0
ファイル: Fleet.cs プロジェクト: sean-h/spacegame
 public void AddSquadron(Squadron squadron)
 {
     squadrons.Add(squadron);
     squadron.squadronDestroyed += SquadronDestroyed;
 }