コード例 #1
0
 public void TriggerShipDeath(ShipBase ship)
 {
     if (OnShipDeath != null)
     {
         OnShipDeath(ship);
     }
 }
コード例 #2
0
ファイル: World.cs プロジェクト: VirtuaIRiot/Game
    public void InitShipAttri(KBEngine.Avatar avatar)
    {
        if (gameObject == null || player == null || avatar == null)
        {
            return;
        }

        ShipBase shipScript = player.GetComponent <ShipBase>();

        if (shipScript == null)
        {
            Debug.LogError("shipScript not found!!");
            return;
        }
        shipScript._attri.Id = avatar.id;

        GameEntity gameScript = player.GetComponent <GameEntity>();

        if (gameScript == null)
        {
            Debug.LogError("gameScript not found!!");
            return;
        }

        gameScript.isPlayer = true;
        gameScript.entityEnable();
        player.name = avatar.className + "_" + avatar.id;

        avatar.renderObj = player;
    }
コード例 #3
0
 public void OnNPCDeath(ShipBase ship)
 {
     if (TargetShip == ship)
     {
         GameManager.Inst.UIManager.HUDPanel.OnClearSelectedObject();
     }
 }
コード例 #4
0
ファイル: MacroAI.cs プロジェクト: rotorist/FringeWorlds
    private ShipBase SpawnPartyMember(MacroAIParty party, Loadout loadout)
    {
        ShipBase ship = GameManager.Inst.NPCManager.SpawnAIShip(loadout, party.FactionID, party);

        ship.transform.position = party.Location.RealPos + UnityEngine.Random.insideUnitSphere * 15f;
        party.SpawnedShips.Add(ship);
        AI ai = ship.GetComponent <AI>();

        ai.MyParty = party;
        if (ship.MyReference.ExhaustController != null)
        {
            ship.MyReference.ExhaustController.setExhaustState(ExhaustState.Normal);
        }

        if (party.SpawnedShipsLeader != null)
        {
            ai.Whiteboard.Parameters["FriendlyTarget"] = party.SpawnedShipsLeader;
        }
        ai.Deactivate();
        if (party.DockedStationID != "")
        {
            Debug.LogError("docked! at " + party.DockedStationID);
            ship.Hide();
            ai.IsDocked          = true;
            ship.DockedStationID = party.DockedStationID;
        }
        ship.name = "AIShip-" + (GameManager.Inst.NPCManager.AllShips.Count + 1);

        Debug.LogError("Spawning ship! " + ai.MyShip.name + " party " + party.PartyNumber);
        GameManager.Inst.NPCManager.AddExistingShip(ship);

        return(ship);
    }
コード例 #5
0
ファイル: ShipModSlots.cs プロジェクト: rotorist/FringeWorlds
    public void Initialize(InvItemData [] shipMods, ShipBase parent)
    {
        ParentShip = parent;
        ShipMods   = new List <ShipMod>();

        //find the active mod
        int activeModIndex = -1;

        for (int i = 0; i < shipMods.Length && i < NumberOfSlots; i++)
        {
            if (shipMods[i] != null && shipMods[i].Item.GetStringAttribute("Equipment Type") == "ActiveShipMod")
            {
                activeModIndex = i;
                string className = shipMods[i].Item.GetStringAttribute("Active Mod Class Name");
                ActiveMod = (ShipMod)System.Activator.CreateInstance(System.Type.GetType(className));
                ActiveMod.Initialize(shipMods[i]);
                ShipMods.Add(ActiveMod);
                Debug.Log("Found ship mod " + ActiveMod.Type);
            }
        }

        //now add the passive mods. this ensures the active mod is always the first one in the list
        for (int i = 0; i < shipMods.Length && i < NumberOfSlots; i++)
        {
            if (shipMods[i] != null && i != activeModIndex)
            {
                ShipModType type = (ShipModType)Enum.Parse(typeof(ShipModType), shipMods[i].Item.GetStringAttribute("Ship Mod Type"));
                ShipMod     mod  = CreateShipModByType(type);
                mod.Initialize(shipMods[i]);
                ShipMods.Add(mod);
                Debug.Log("Found ship mod " + mod.Type);
            }
        }
    }
コード例 #6
0
ファイル: World.cs プロジェクト: VirtuaIRiot/Game
    public void AddcameraFllow()
    {
        if (gameObject == null || player != null)
        {
            Camera mainCamera = Camera.main;

            Debug.Log("<---------mainCamera------------>:" + mainCamera);

            if (mainCamera == null)
            {
                Debug.LogError("mainCamera not found:" + mainCamera);
            }

            Follow cameraFllow = mainCamera.GetComponent <Follow>();
            if (cameraFllow == null)
            {
                Debug.LogError("cameraFllow not found:" + cameraFllow);
            }

            ShipBase myship = player.GetComponent <ShipBase>();
            if (myship == null)
            {
                Debug.LogError("myship not found:" + myship);
            }

            cameraFllow.AttachTarget(player.transform, myship.camerOffset);
        }
    }
コード例 #7
0
    public override void ApplyModToShip(ShipBase ship)
    {
        ShieldBase shield = ship.Shield;

        if (shield == null)
        {
            return;
        }

        foreach (KeyValuePair <string, float> attribute in NumericAttributes)
        {
            switch (attribute.Key)
            {
            case "Capacity":
                shield.TotalCapacity += attribute.Value;
                break;

            case "Capacity%":
                shield.TotalCapacity += shield.TotalCapacity * attribute.Value;
                break;

            case "RechargeRate":
                shield.RechargeRate += attribute.Value;
                break;

            case "RechargeRate%":
                shield.RechargeRate += shield.RechargeRate * attribute.Value;
                break;
            }
        }

        Debug.Log("Shield capacity " + shield.TotalCapacity);
    }
コード例 #8
0
    public void SyncLoadoutWithShip(Loadout loadout, ShipBase ship)
    {
        loadout.AmmoBayItems = new List <InvItemData>();
        foreach (KeyValuePair <string, InvItemData> itemData in ship.Storage.AmmoBayItems)
        {
            loadout.AmmoBayItems.Add(itemData.Value);
        }

        loadout.CargoBayItems = new List <InvItemData>();
        foreach (InvItemData itemData in ship.Storage.CargoBayItems)
        {
            loadout.CargoBayItems.Add(itemData);
        }

        loadout.CurrentPowerMgmtButton = ship.CurrentPowerMgmtButton;
        loadout.HullAmount             = ship.HullAmount;
        loadout.FuelAmount             = ship.FuelAmount;
        loadout.LifeSupportAmount      = ship.LifeSupportAmount;

        //sync weapon ammo assignment
        foreach (WeaponJoint joint in ship.MyReference.WeaponJoints)
        {
            if (joint.MountedWeapon != null && loadout.WeaponJoints.ContainsKey(joint.JointID))
            {
                loadout.WeaponJoints[joint.JointID].RelatedItemID = joint.MountedWeapon.AmmoID;
            }
        }
    }
コード例 #9
0
ファイル: NPCManager.cs プロジェクト: rotorist/FringeWorlds
 public void AddExistingShip(ShipBase ship)
 {
     if (!_allShips.Contains(ship))
     {
         _allShips.Add(ship);
     }
 }
コード例 #10
0
ファイル: NPCManager.cs プロジェクト: rotorist/FringeWorlds
 public void RemoveExistingShip(ShipBase ship)
 {
     if (_allShips.Contains(ship))
     {
         _allShips.Remove(ship);
     }
 }
コード例 #11
0
    public void OnSelectShip(ShipBase ship)
    {
        ClearTargetData();

        _selectedObject = ship.transform;
        if (_currentSelectMarker != null)
        {
            //remove current marker
            GameObject.Destroy(_currentSelectMarker.gameObject);
        }

        GameObject o = GameObject.Instantiate(Resources.Load("SelectedShipMarkerHostile")) as GameObject;

        _currentSelectMarker   = o.GetComponent <SelectedObjMarker>();
        o.transform.parent     = transform;
        o.transform.localScale = new Vector3(1, 1, 1);
        _currentSelectMarker.Initialize(100f, ship.name);

        ShipReference shipRef = ship.ShipModel.GetComponent <ShipReference>();

        TargetShieldValue.text = "SHLD " + (int)ship.Shield.Amount;
        TargetHullValue.text   = "HULL " + (int)ship.HullAmount;
        GameObject hologram = GameObject.Instantiate(Resources.Load(ship.ShipModelID + "Hologram")) as GameObject;

        TargetHologram                      = hologram;
        hologram.transform.parent           = HologramHolder3D;
        hologram.transform.localPosition    = Vector3.zero;
        hologram.transform.localEulerAngles = Vector3.zero;
        float scale = shipRef.HologramScale;

        hologram.transform.localScale = new Vector3(scale, scale, scale);
        TargetDescLabel.text          = shipRef.Name + " - " + "New Dawn";
        TargetRepLabel.color          = new Color(1, 0.3f, 0.3f);
        TargetRepLabel.text           = "HOSTILE";
    }
コード例 #12
0
ファイル: NPCManager.cs プロジェクト: rotorist/FringeWorlds
 public void OnShipDeath(ShipBase ship)
 {
     if (_allShips.Contains(ship))
     {
         _allShips.Remove(ship);
     }
 }
コード例 #13
0
        /// <summary>
        /// Метод возвращает корабль в зависимости от перданного типа корaбля
        /// </summary>
        /// <param name="shipType"></param>
        /// <returns>Корабль полученый из строки</returns>
        private ShipBase CreateShipFromString(string shipType)
        {
            ShipBase shipBase = null;

            switch (shipType)
            {
            case "b":
                shipBase = new BattleShip();     // линкор
                break;

            case "c":
                shipBase = new Carrier();       // эсминец
                break;

            case "cr":
                shipBase = new Cruiser();       // крейсер
                break;

            case "s":
                shipBase = new Submarine();     // подлодка
                break;

            default:
                throw new Exception("Нет так кого корабля!");
            }
            return(shipBase);
        }
コード例 #14
0
    public DockRequestResult MidwayDock(ShipBase requester, out DockSessionBase session, int direction)
    {
        Debug.LogError("Midway dock " + ID);
        if (direction == -1)
        {
            if (_dockingStageA > 0 || _sessionA != null)
            {
                session = null;
                return(DockRequestResult.Busy);
            }
            DockingEffectA.SetStage(2);
            _dockingStageA = 3;
            _sessionA      = new TLTransitSession(requester, -1, this);
            session        = _sessionA;
            _sessionA.StartMidwaySession();
            return(DockRequestResult.Accept);
        }
        else if (direction == 1)
        {
            if (_dockingStageB > 0 || _sessionB != null)
            {
                session = null;
                return(DockRequestResult.Busy);
            }
            DockingEffectB.SetStage(2);
            _dockingStageB = 3;
            _sessionB      = new TLTransitSession(requester, 1, this);
            session        = _sessionB;
            _sessionB.StartMidwaySession();
            return(DockRequestResult.Accept);
        }

        session = null;
        return(DockRequestResult.Deny);
    }
コード例 #15
0
ファイル: AI.cs プロジェクト: rotorist/FringeWorlds
    // Use this for initialization
    public virtual void Initialize(MacroAIParty party, Faction faction)
    {
        RunningNodeHist = new MaxStack <string>(20);

        AimSkill                     = UnityEngine.Random.Range(0.6f, 1f);
        MyShip                       = transform.GetComponent <ShipBase>();
        AvoidanceDetector            = MyShip.MyReference.AvoidanceDetector;
        AvoidanceDetector.ParentShip = MyShip;

        Whiteboard = new Whiteboard();
        Whiteboard.Initialize();

        //AttackTarget = GameManager.Inst.PlayerControl.PlayerShip;

        //Whiteboard.Parameters["TargetEnemy"] = AttackTarget;
        Whiteboard.Parameters["SpeedLimit"] = -1f;

        MyParty       = party;
        MyFaction     = faction;
        MyPartyNumber = MyParty.PartyNumber;

        WeaponControl = new AIWeaponControl();
        WeaponControl.Initialize(this);

        TreeSet = new Dictionary <string, BehaviorTree>();
        TreeSet.Add("BaseBehavior", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("BaseBehavior", this, party));
        TreeSet.Add("Travel", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("Travel", this, party));
        TreeSet.Add("FollowFriendly", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("FollowFriendly", this, party));
        TreeSet.Add("FighterCombat", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("FighterCombat", this, party));
        TreeSet.Add("BigShipCombat", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("BigShipCombat", this, party));
    }
コード例 #16
0
 public override void ApplyModToShip(ShipBase ship)
 {
     MyShip         = ship;
     MyShield       = ship.Shield;
     _currentCharge = 0;
     _capacity      = NumericAttributes["Capacity"];
 }
コード例 #17
0
ファイル: BTChaseEnemy.cs プロジェクト: rotorist/FringeWorlds
    public override BTResult Process()
    {
        //Debug.Log("Processing Chase Enemy " + MyAI.name);

        ShipBase target = (ShipBase)MyAI.Whiteboard.Parameters[Parameters[0]];

        if (target != null)
        {
            float dist  = Vector3.Distance(MyAI.MyShip.transform.position, target.transform.position);
            float angle = Vector3.Angle(target.transform.position - MyAI.MyShip.transform.position, MyAI.MyShip.transform.forward);
            if (dist <= 20)
            {
                return(Exit(BTResult.Success));
            }
            if (dist <= (float)MyAI.Whiteboard.Parameters["FiringRange"] && angle < 20)
            {
                return(Exit(BTResult.Success));
            }
            else
            {
                MyAI.Whiteboard.Parameters["Destination"] = target.transform.position;
                //Vector3 aimPoint = StaticUtility.FirstOrderIntercept(MyAI.MyShip.transform.position, MyAI.MyShip.RB.velocity,
                //													30, target.transform.position, target.RB.velocity);
                MyAI.Whiteboard.Parameters["AimPoint"] = Vector3.zero;

                return(Running());
            }
        }
        else
        {
            return(Exit(BTResult.Fail));
        }
    }
コード例 #18
0
    public TLTransitSession(ShipBase leader, int direction, Tradelane currentTradelane)
    {
        Passengers = new List <ShipBase>();
        PassengerTargetRotations = new Dictionary <ShipBase, Quaternion>();
        PassengerTargetPositions = new Dictionary <ShipBase, RelLoc>();
        Party           = leader.MyAI.MyParty;
        LeaderPassenger = leader;

        Direction        = direction;
        Stage            = TLSessionStage.None;
        CurrentTradelane = currentTradelane;

        if (Direction == -1)
        {
            CurrentTrigger = CurrentTradelane.TriggerA;
        }
        else
        {
            CurrentTrigger = CurrentTradelane.TriggerB;
        }

        if (leader == GameManager.Inst.PlayerControl.PlayerShip)
        {
            GameManager.Inst.PlayerControl.CurrentTradelaneSession = this;
        }
    }
コード例 #19
0
    public override BTResult Process()
    {
        //Debug.Log("processing fighter evade");

        if (this.LastRunTime <= 0)
        {
            this.LastRunTime = Time.time;
        }
        float deltaTime = Time.time - this.LastRunTime;

        this.LastRunTime = Time.time;



        Vector3  threatPos = Vector3.zero;
        ShipBase target    = (ShipBase)MyAI.Whiteboard.Parameters["TargetEnemy"];

        if (target != null)
        {
            threatPos = target.transform.position;
        }

        Vector3 evadeDir = (Vector3)MyAI.Whiteboard.Parameters["EvadeDir"];

        if (evadeDir == Vector3.zero)
        {
            //Debug.Log("Recalculating evade dir");
            _rawDest = MyAI.MyShip.transform.position + new Vector3(UnityEngine.Random.value * 30, UnityEngine.Random.value * 30, UnityEngine.Random.value * 30);
            //find a random direction perpendicular to los
            Vector3 planeNormal = MyAI.MyShip.transform.forward;
            if (threatPos != Vector3.zero)
            {
                planeNormal = MyAI.MyShip.transform.position - threatPos;
            }
            Vector3 projVec = Vector3.ProjectOnPlane((_rawDest - MyAI.MyShip.transform.position), planeNormal);
            if (projVec == Vector3.zero)
            {
                projVec = MyAI.MyShip.transform.right;
            }
            evadeDir = projVec.normalized - planeNormal.normalized * UnityEngine.Random.Range(0.0f, 0.3f);
            MyAI.Whiteboard.Parameters["EvadeDir"] = evadeDir;
        }

        MyAI.Whiteboard.Parameters["IsThrusting"] = true;

        Debug.DrawRay(MyAI.MyShip.transform.position, evadeDir * 30, Color.blue);
        MyAI.Whiteboard.Parameters["Destination"] = MyAI.MyShip.transform.position + evadeDir.normalized * 30;

        _evadeTimer += deltaTime;

        if (_evadeTimer < _evadeTimeout)
        {
            return(Running());
        }
        else
        {
            return(Exit(BTResult.Success));
        }
    }
コード例 #20
0
    void Start()
    {
        //ShipBase taurus = gameObject.AddComponent<ShipBase>();
        //taurus.plan = plan;
        ShipBase taurus = new ShipBase(plan);

        taurus.spawn(transform);
    }
コード例 #21
0
ファイル: JumpGate.cs プロジェクト: rotorist/FringeWorlds
 public override DockRequestResult Dock(ShipBase requester, out DockSessionBase session)
 {
     Debug.Log("Begin docking at jumpgate " + this.ID);
     IsGateActive = true;
     _activeTimer = 0;
     session      = null;
     return(DockRequestResult.Accept);
 }
コード例 #22
0
ファイル: Grid.cs プロジェクト: srpeirce/battleships
        public void PlaceShipAtRandom(ShipBase ship)
        {
            var placement = _randomPlacementSelector.Select(Squares, ship.Size);

            ship.Occupy(placement);

            Ships.Add(ship);
        }
コード例 #23
0
ファイル: JumpGate.cs プロジェクト: rotorist/FringeWorlds
    public override DockRequestResult Undock(ShipBase requester, out DockSessionBase session)
    {
        Vector3 spawnLoc = DockingTrigger.transform.position + SpawnDisposition;

        requester.transform.position = spawnLoc;
        requester.transform.rotation = Quaternion.LookRotation(DockingTrigger.transform.up, Vector3.up);
        session = null;
        return(DockRequestResult.Accept);
    }
コード例 #24
0
ファイル: PlayerDataManager.cs プロジェクト: PenpenLi/Nav
 public bool AddTargetShip(ShipBase ship)
 {
     if (m_targetShipList.Count > GlobalVar.GetInstance().GetMaxShips())
     {
         return(false);
     }
     m_targetShipList.Add(ship);
     return(true);
 }
コード例 #25
0
ファイル: NPCManager.cs プロジェクト: rotorist/FringeWorlds
    public void BuildShip(ShipBase ship, Loadout loadout, string factionID, MacroAIParty party)
    {
        string   shipModelID = loadout.ShipID;
        ShipType shipType    = loadout.ShipType;

        GameObject shipModel = GameObject.Instantiate(Resources.Load(shipModelID)) as GameObject;
        ShipStats  stats     = GameManager.Inst.ItemManager.GetShipStats(shipModelID);

        shipModel.transform.parent           = ship.transform;
        shipModel.transform.localScale       = new Vector3(1, 1, 1);
        shipModel.transform.localPosition    = Vector3.zero;
        shipModel.transform.localEulerAngles = Vector3.zero;
        ship.ShipModel              = shipModel;
        ship.ShipModelID            = shipModelID;
        ship.MyReference            = shipModel.GetComponent <ShipReference>();
        ship.MyReference.ParentShip = ship;
        ship.MyReference.Defensives = new List <Defensive>();
        ship.MyReference.ShipAudio  = ship.GetComponent <AudioSource>();
        ship.HullCapacity           = stats.Hull;
        ship.HullAmount             = loadout.HullAmount;
        ship.MaxFuel           = stats.MaxFuel;
        ship.FuelAmount        = loadout.FuelAmount;
        ship.MaxLifeSupport    = stats.LifeSupport;
        ship.LifeSupportAmount = loadout.LifeSupportAmount;
        ship.PowerSupply       = stats.PowerSupply;
        ship.TorqueModifier    = stats.TurnRate;
        ship.PowerSupply       = stats.PowerSupply;
        ship.ShieldPowerAlloc  = 1;
        ship.WeaponPowerAlloc  = 1;
        ship.EnginePowerAlloc  = 1;
        ship.Shield            = ship.MyReference.Shield.GetComponent <ShieldBase>();
        ship.Shield.Initialize(loadout.Shield);
        ship.Shield.ParentShip = ship;
        ship.RB = ship.GetComponent <Rigidbody>();
        ship.RB.inertiaTensor = new Vector3(1, 1, 1);
        ship.Engine           = shipModel.GetComponent <Engine>();
        ship.Engine.Initialize(stats);
        ship.Thruster = shipModel.GetComponent <Thruster>();
        ship.Thruster.Initialize(loadout.Thruster);
        ship.Scanner = shipModel.GetComponent <Scanner>();
        ship.Scanner.Initialize(loadout.Scanner);
        ship.Storage = shipModel.GetComponent <ShipStorage>();
        ship.Storage.Initialize();
        ship.Storage.AmmoBaySize  = stats.AmmoBaySize;
        ship.Storage.CargoBaySize = stats.CargoBaySize;
        ship.WeaponCapacitor      = shipModel.GetComponent <WeaponCapacitor>();
        ship.WeaponCapacitor.Initialize(loadout.WeaponCapacitor);

        ship.ShipModSlots = shipModel.GetComponent <ShipModSlots>();
        ship.ShipModSlots.NumberOfSlots = stats.ModSlots;
        ship.ShipModSlots.Initialize(loadout.ShipMods, ship);
        ship.ShipModSlots.ApplyMods();


        ship.MyLoadout = loadout;
    }
コード例 #26
0
ファイル: NPCManager.cs プロジェクト: rotorist/FringeWorlds
    public ShipBase SpawnPlayerShip(Loadout loadout, string factionID, MacroAIParty party)
    {
        ShipBase ship = GameManager.Inst.PlayerControl.PlayerShip;

        BuildShip(ship, loadout, factionID, party);

        Autopilot pilot = GameManager.Inst.PlayerControl.PlayerAutopilot;

        pilot.AvoidanceDetector            = ship.MyReference.AvoidanceDetector;
        pilot.AvoidanceDetector.ParentShip = ship;


        //load weapons
        foreach (WeaponJoint joint in ship.MyReference.WeaponJoints)
        {
            joint.ParentShip = ship;
            foreach (KeyValuePair <string, InvItemData> jointSetup in loadout.WeaponJoints)
            {
                if (jointSetup.Key == joint.JointID && jointSetup.Value != null)
                {
                    joint.LoadWeapon(jointSetup.Value);
                }
            }
        }

        for (int i = 0; i < loadout.Defensives.Count; i++)
        {
            if (loadout.Defensives[i] != null && loadout.Defensives[i].Item.GetStringAttribute("Defensive Type") == "Countermeasure")
            {
                CMDispenser dispenser = new CMDispenser();
                dispenser.ParentShip = ship;
                dispenser.AmmoID     = loadout.Defensives[i].RelatedItemID;
                dispenser.Type       = DefensiveType.Countermeasure;
                ship.MyReference.Defensives.Add(dispenser);
            }
        }

        //load ammo bay
        ship.Storage.AmmoBayItems = new Dictionary <string, InvItemData>();
        foreach (InvItemData item in loadout.AmmoBayItems)
        {
            ship.Storage.AmmoBayItems.Add(item.Item.ID, item);
        }

        ship.Storage.CargoBayItems = new List <InvItemData>();
        foreach (InvItemData item in loadout.CargoBayItems)
        {
            ship.Storage.CargoBayItems.Add(item);
        }
        //In$8177BB
        //load power management setting
        ship.CurrentPowerMgmtButton = loadout.CurrentPowerMgmtButton;


        return(ship);
    }
コード例 #27
0
        public override void GenerateIntoMap(Map map)
        {
            ShipBase newShip = (ShipBase)ThingMaker.MakeThing(this.ShipDef);

            newShip.SetFaction(Faction.OfPlayer);
            newShip.ShouldSpawnFueled = true;
            this.StartingShips.Add(newShip);
            DropShipUtility.LoadNewCargoIntoRandomShips(this.PlayerStartingThings().ToList(), this.StartingShips);
            DropShipUtility.DropShipGroups(map.Center, map, this.StartingShips, TravelingShipArrivalAction.EnterMapFriendly);
        }
コード例 #28
0
    private void Start()
    {
        shipScript = GetComponent <ShipBase>();

        if (shipScript == null)
        {
            Debug.LogError("shipScript not found!!");
            return;
        }
    }
コード例 #29
0
    private void UpdateFirstPerson()
    {
        ShipBase playerShip = GameManager.Inst.PlayerControl.PlayerShip;

        if (playerShip.MyReference.FPCameraAnchor != null)
        {
            transform.parent           = playerShip.MyReference.FPCameraAnchor;
            transform.localEulerAngles = Vector3.zero;
            transform.localPosition    = Vector3.zero;
        }
    }
コード例 #30
0
    private void OnParticleCollision(GameObject other)
    {
        ShipBase enemy = other.GetComponentInParent <ShipBase>();

        if (!enemy)
        {
            return;
        }

        enemy.Damage(ship ? ship.damage : damage);
    }
コード例 #31
0
		/// <summary>
		/// LoadContent will be called once per game and is the place to load
		/// all of your content.
		/// </summary>
		protected override void LoadContent ()
		{
			// Create a new SpriteBatch, which can be used to draw textures.
			spriteBatch = new SpriteBatch (GraphicsDevice);

			//TODO: use this.Content to load your game content here 

			spriteFont = Content.Load<SpriteFont>("DejaVuSans");
			//spriteFont = Content.Load<SpriteFont>("Contnt/bin/Windows/gfx/DejaVuSans");
			gfl = null;

			playerShips = new ObjectShip[Settings.Current.Players.Length];
			gfl = GravitiForceLevel.ReadGravitiForceLevelFile("GRBomber's Delight.GFB");

			levelBackground = LevelBackgroundGF.CreateLevelBackground(GraphicsDevice, gfl, Content);

			shipBase = new ShipBase[playerShips.Length];
			shipBase[0] =
				new ShipBase(new Vector3(gfl.playerBase[0].X - 104, 999 - gfl.playerBase[0].Y, 0f));
			shipBase[1] =
				new ShipBase(new Vector3(gfl.playerBase[1].X - 104, 999 - gfl.playerBase[1].Y, 0f));

			for(int i = 0; i < playerShips.Length; i++)
			{
				playerShips[i] = ObjectShip.CreateShip(GraphicsDevice, Content);

				playerShips[i].Position = shipBase[i].Position;
			}
			bullerBuffer = new BulletBuffer(GraphicsDevice, Content);
		}