Example #1
0
    public void StartFire(SO_ship _target)
    {
        target = _target;
//		Debug.Log ("====laser pew to " + target.p.SO.visibleName);
//		Debug.Log( laser_shot.GetPosition(0)+ "    "  +  laser_shot.GetPosition(1));
        laser_shot.enabled = true;
    }
Example #2
0
    void UpdateShip(SO_ship ship)
    {
//        var control = nearestShips[ship.p.id].GetComponent<ShipMotor>();
//		control.selectedTarget=nearestShips [ship.target_id];
//		control.action=ship.action;
        nearestShips[ship.p.SO.id].GetComponent <ShipMotor>().thisShip.p.SO.position = ship.p.SO.position;
        nearestShips[ship.p.SO.id].GetComponent <ShipMotor>().thisShip.p.SO.rotation = ship.p.SO.rotation;
    }
Example #3
0
 void ChangePlayer()
 {
     player_SO = serverObj.GetComponent <Server>().GetPlayer(player_id);     //player id=0
     player.GetComponent <ShipMotor>().thisShip.p.SO.position = player_SO.p.SO.position;
     player.GetComponent <ShipMotor>().thisShip.p.SO.rotation = player_SO.p.SO.rotation;
     if (player_SO.landed)
     {
         int station_id = serverObj.GetComponent <LandingServer>().FindShipLocation(player_SO.p.SO.id);
         SceneManager.LoadScene("station");
     }
 }
Example #4
0
//	---------------------  SO END ---------------------------------

//	---------------------  SHIPS ---------------------------------
    void AddShip(SO_ship ship)
    {
        Debug.Log("prefub " + ship.p.SO.prefab);
        GameObject gObj = (GameObject)Instantiate(Resources.Load(ship.p.SO.prefab, typeof(GameObject)), ship.p.SO.position - zeroPoint, ship.p.SO.rotation);         // подставить ship.p.SO.prefab

        gObj.GetComponent <ShipMotor> ().Init(ship, serverObj, this.gameObject);
        gObj.GetComponent <ShipMotor> ().thisShip.SetTarget(player.GetComponent <ShipMotor> ().thisShip.p.SO);
        Debug.Log(ship.p.SO.visibleName);
        nearestShips.Add(ship.p.SO.id, gObj);
        canvasobj.GetComponent <Indicators> ().AddIndicator_sh(gObj);
    }
Example #5
0
    public void StartFire(SO_ship target)
    {
//        Debug.Log("StartFire  "+ type);
        switch (type)
        {
        case SO_weaponData.WeaponType.laser:

            gameObject.GetComponent <LaserBeam>().StartFire(target);
            break;

        case SO_weaponData.WeaponType.missile:
            gameObject.GetComponent <MissileLauncher>().Fire(target.host);
            break;
        }
    }
Example #6
0
 public void Init(SO_ship _ship, GameObject _server, GameObject _datalocal)
 {
     thisShip = new SO_ship(_ship.p, this.gameObject);
     Debug.Log(this);
     if (thisShip.weapons.Count <= weaponPoints.Count)
     {
         for (int i = 0; i < thisShip.weapons.Count; i++)
         {
             thisShip.weapons[i].SetWeaponPoint(weaponPoints[i]);
             weaponPoints [i].GetComponent <WeaponPoint> ().Init(thisShip.weapons [i].p.type);
             Debug.Log(thisShip.p.SO.visibleName + " init weapon point " + thisShip.weapons [i].p.type + i);
         }
     }
     Server_GO = _server;
     dataLocal = _datalocal;
     Debug.Log("----init   " + thisShip.p.SO.visibleName + "  id   " + thisShip.p.SO.id);
 }
Example #7
0
    void Start()
    {
        player_id = 0;
        serverObj = GameObject.Find("ServerGo");
        player_SO = serverObj.GetComponent <Server>().GetPlayer(player_id);     //player id=0
        //init player
        player.GetComponent <ShipMotor>().Init(player_SO, serverObj, this.gameObject);
        zeroPoint = player_SO.p.SO.position;
//		WaypointsCreate ();
//		var player_transform = player.GetComponent<Transform> ();
//		StartCoroutine (FlyObjectsListUpdate ());
//		 shipcoroutine= StartCoroutine (ShipsListUpdate ());
//		 socoroutine= StartCoroutine (SOListUpdate ());
        coroutineSH = ShipsListUpdate();
        coroutineSO = SOListUpdate();
        StartCoroutine(coroutineSH);
        StartCoroutine(coroutineSO);
    }
Example #8
0
    public void Events(SO_ship.ShipEvenentsType shipEvent, SO_ship ship)
    {
        if (ship == thisShip)
        {
            switch (shipEvent)
            {
            case SO_ship.ShipEvenentsType.stop:
                Debug.Log("motor " + thisShip.p.SO.visibleName + " ship stopped");
                burner.GetComponent <BurnControl> ().EngineStop();
                break;

            case SO_ship.ShipEvenentsType.move:
                Debug.Log("motor " + thisShip.p.SO.visibleName + " ship accelerated");
                burner.GetComponent <BurnControl> ().EngineStart();
                break;

            case SO_ship.ShipEvenentsType.warmwarp:
                Debug.Log("motor " + thisShip.p.SO.visibleName + " ship preparing to warp");
                burner.GetComponent <BurnControl> ().WarpStart();
                break;

            case SO_ship.ShipEvenentsType.warp:

                Debug.Log("motor " + thisShip.p.SO.visibleName + " ship warping....");
//			if player
                dataLocal.GetComponent <Effects> ().PlayerWarp(thisShip.targetToMove.position, thisShip.p.warpSpeed);
                break;

            case SO_ship.ShipEvenentsType.spawn:
                Debug.Log("motor " + thisShip.p.SO.visibleName + " ship spawn");
                dataLocal.GetComponent <Effects> ().PlayerWarpStop();
                burner.GetComponent <BurnControl> ().WarpStop();
                Spawn();
                break;

            case SO_ship.ShipEvenentsType.land:
                Debug.Log("motor " + thisShip.p.SO.visibleName + " ship landing");
                Server_GO.GetComponent <LandingServer> ().Landing(thisShip.p.SO.id, thisShip.targetToMove.id);
                thisShip.landed = true;
                break;

            case SO_ship.ShipEvenentsType.destroyed:
                Debug.Log("motor " + thisShip.p.SO.visibleName + " ship destroyed");
                StopAtacking();
                StopEquipments();
//			thisShip = null;
                //var detonator = gameObject.AddComponent<Detonator> ();
                //detonator.duration = 4;
                //detonator.destroyTime = 4;
                //detonator.size = 40;
                //detonator.autoCreateSmoke = false;
                //detonator.autoCreateHeatwave = false;
                //detonator.color = Color.white;
                //detonator.destroyObj = false;
                //detonator.Explode ();
                thisShip.p.destroyed = true;
                Debug.Log("********************       explosion");
                dataLocal.GetComponent <ShowEnv> ().DestroyShip(thisShip.p.SO.id);
                break;

            case SO_ship.ShipEvenentsType.open:
                GameObject canvasObj = GameObject.Find("Canvas");
                canvasObj.GetComponent <ShowMenus> ().ShowInventory(thisShip.p.SO.id, thisShip.targetToMove.id);
                break;
            }
        }
    }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        SO_ship playerSO = player.GetComponent <ShipMotor> ().thisShip;

        speedometerText.text = "s " + playerSO.p.shield.ToString().Substring(0, 3) + "\n" + "c " + playerSO.p.capasitor.ToString().Substring(0, 3);
    }