Ejemplo n.º 1
0
    /// <summary>
    /// 敌人自动开火启动
    /// </summary>
    public void OpenShipFireAutoForEnemy()
    {
        ShipCpt shipCpt      = manager.GetShip(CharacterTypeEnum.Enemy);
        Vector3 firePosition = handler_Scene.GetFirePosition(CharacterTypeEnum.Enemy);

        shipCpt.StartAutoOpenFire(firePosition);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 舰队开火
    /// </summary>
    /// <param name="characterType"></param>
    public void ShipFire(CharacterTypeEnum characterType)
    {
        ShipCpt shipCpt      = manager.GetShip(characterType);
        Vector3 firePosition = handler_Scene.GetFirePosition(characterType);

        shipCpt.OpenFire(firePosition);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 创建舰队
    /// </summary>
    /// <param name="goldData"></param>
    public void CreateShip(GameObject objModel, GameObject objBullet, ShipDataBean shipData, Vector3 position, Vector3 startPlayerAngles, Vector3 startEnemyAngles)
    {
        GameObject itemObj = Instantiate(gameObject, objModel, position);
        ShipCpt    shipCpt = itemObj.AddComponent <ShipCpt>();

        shipCpt.SetData(shipData, objBullet);
        if (shipData.characterType == CharacterTypeEnum.Player)
        {
            shipForPlayer = shipCpt;
            itemObj.transform.eulerAngles = startPlayerAngles;
        }
        else if (shipData.characterType == CharacterTypeEnum.Enemy)
        {
            shipForEnemy = shipCpt;
            itemObj.transform.eulerAngles = startEnemyAngles;
        }
    }
Ejemplo n.º 4
0
    public void HandleForBack()
    {
        if (aiForCharacterPath.IsAutoMoveStopForEndPath())
        {
            System.Action afterAction = () =>
            {
                //扔完之后处理
                if (handler_Gold.GetTargetGold(transform.position) == null)
                {
                    //如果没有金币。说明已经搬完 回收
                    SetIntentForIdle();
                    handler_Character.CleanCharacter(this);
                    Destroy(gameObject);
                }
                else
                {
                    SetIntentForGoToIsland();
                }
            };

            if (handGold != null)
            {
                //增加角色金币
                long addGold = handler_Game.AddGoldNumber(characterData.characterType, handGold.goldData.gold_price, 1);
                //刷新UI
                handler_Gold.manager_UI.RefreshAllUI();
                //回收金币
                ShipCpt shipCpt = handler_Ship.GetShip(characterData.characterType);
                handGold.SetRecycle(addGold, shipCpt.transform.position);
                //角色扔金币
                characterAnim.SetCharacterThrow(null, afterAction);
            }
            else
            {
                afterAction?.Invoke();
            }
            //检测游戏是否结束
            handler_Game.CheckGameOver();
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 改变玩家舰队攻击力
    /// </summary>
    public void ChangePlayerShipDamage(int damage)
    {
        ShipCpt shipCpt = manager.GetShip(CharacterTypeEnum.Player);

        shipCpt.SetDamage(damage);
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 关闭敌人自动开火
    /// </summary>
    public void CloseShipFireAutoForEnemy()
    {
        ShipCpt shipCpt = manager.GetShip(CharacterTypeEnum.Enemy);

        shipCpt.CloseFire();
    }