Beispiel #1
0
    void Start()
    {
        Game.BattleManager = this;
        Game.PlayerName    = "Player";

        StrategyView();


        var PlayerFleet = BattleAction.AddBasicFleet("Player");
        var EnemyFleet  = BattleAction.AddBasicFleet("Enemy");

        BattleAction.DeployFleet(PlayerFleet);
        BattleAction.DeployFleet(EnemyFleet);

        battlePlane.onClickPoint      += BattlePlane_onClickPoint;
        battlePlane.onRightClickPoint += BattlePlane_onRightClickPoint;
        battlePlane.onClickUnit       += BattlePlane_onClickUnit;
        battlePlane.onRightClickUnit  += BattlePlane_onRightClickUnit;

        foreach (var unit in AllUnits)
        {
            if (unit.state.Owner == "Player")
            {
                if (ActiveUnit == null)
                {
                    selectUnit(unit);
                }
            }

            if (unit.targetType == TargetType.ally || unit.targetType == TargetType.self)
            {
                var unitBorder = Instantiate(UnitHighlighter);
                unitBorder.gameObject.SetActive(true);
                unitBorder.transform.position = unit.transform.position;
                unitBorder.transform.SetParent(unit.transform);
            }


            if (unit.targetType == TargetType.enemy)
            {
                var unitBorder = Instantiate(EnemyHighlighter);
                unitBorder.gameObject.SetActive(true);
                unitBorder.transform.position = unit.transform.position;
                unitBorder.transform.SetParent(unit.transform);
            }
        }
        RangeFinding();
        selectTarget(getClosestTarget(TargetType.enemy));
    }