コード例 #1
0
 void Awake()
 {
     PSS            = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerShipScript>();
     _rb            = GetComponent <Rigidbody2D>();
     _damage        = PSS._damage;
     _speed         = 15;
     _timeToDestroy = 3;
     Destroyy();
     _rb.AddForce(new Vector2(0, 1) * _speed, ForceMode2D.Impulse);
 }
コード例 #2
0
 void OnTriggerEnter(Collider c)
 {
     if (c.tag == "player")
     {
         PlayerShipScript PPS = c.GetComponent <PlayerShipScript>();
         if (PPS != null)
         {
             PPS.DamageShip(1);
         }
     }
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        ship = PlayerShipScript.player;

        spriteRenderer = GetComponent<SpriteRenderer>();
        startColor = spriteRenderer.color;

        //Ship is attached to the parent game object
        //ship = transform.parent.gameObject.GetComponent<PlayerShipScript>();

        attaching = false;
    }
コード例 #4
0
    void Awake()
    {
        player = this;

        m_alive = true;

        InitShip();

        // The camera is parented to a GO and offset on the Z axis
        // We're keeping the parent so we don't have to set the Z when moving the camera
        m_cameraTransform = Camera.main.transform.parent;
    }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        ship = PlayerShipScript.player;

        spriteRenderer = GetComponent <SpriteRenderer>();
        startColor     = spriteRenderer.color;

        //Ship is attached to the parent game object
        //ship = transform.parent.gameObject.GetComponent<PlayerShipScript>();

        attaching = false;
    }
コード例 #6
0
ファイル: Contract.cs プロジェクト: Honeybunch/Space
 public Contract(string p_Name, string p_Description, string p_Title, string p_Reward)
 {
     contractObjectives = new List<GameObject> ();
     completed = false;
     objectivePosition = new Vector3 (Random.Range(-100,100), Random.Range(-100,100), 0);
     targetImagePath = "Image Directory";
     targetShipImagePath = "ShipImage Directory";
     name = p_Name;
     title = p_Title;
     description = p_Description;
     reward = p_Reward;
     player = GameObject.Find ("Player Ship").GetComponent<PlayerShipScript>();
 }
コード例 #7
0
ファイル: Contract.cs プロジェクト: Honeybunch/Space
 public Contract()
 {
     contractObjectives = new List<GameObject> ();
     completed = false;
     objectivePosition = new Vector3 (Random.Range(-100,100), Random.Range(-25,25), 0);
     description = "Go here!";
     targetImagePath = "Image Directory";
     targetShipImagePath = "ShipImage Directory";
     name = "Unknown";
     title = "Unknown Title";
     reward = "0 Space Dollars";
     player = GameObject.Find ("Player Ship").GetComponent<PlayerShipScript>();
 }
コード例 #8
0
 public Contract()
 {
     contractObjectives  = new List <GameObject> ();
     completed           = false;
     objectivePosition   = new Vector3(Random.Range(-100, 100), Random.Range(-25, 25), 0);
     description         = "Go here!";
     targetImagePath     = "Image Directory";
     targetShipImagePath = "ShipImage Directory";
     name   = "Unknown";
     title  = "Unknown Title";
     reward = "0 Space Dollars";
     player = GameObject.Find("Player Ship").GetComponent <PlayerShipScript>();
 }
コード例 #9
0
 public Contract(string p_Name, string p_Description, string p_Title, string p_Reward)
 {
     contractObjectives  = new List <GameObject> ();
     completed           = false;
     objectivePosition   = new Vector3(Random.Range(-100, 100), Random.Range(-100, 100), 0);
     targetImagePath     = "Image Directory";
     targetShipImagePath = "ShipImage Directory";
     name        = p_Name;
     title       = p_Title;
     description = p_Description;
     reward      = p_Reward;
     player      = GameObject.Find("Player Ship").GetComponent <PlayerShipScript>();
 }
コード例 #10
0
    void Start()
    {
        EventManager.AddEventListener(EventDefs.PLAYER_HEALTH_UPDATE, UpdateHealth);
        EventManager.AddEventListener(EventDefs.PLAYER_SHIELD_UPDATE, UpdateShield);

        playerShip             = PlayerShipScript.player;
        healthCicle.fillAmount = playerShip.MaxHealth / 100f;
        ShieldScript playerShield = playerShip.Shield;

        if (playerShield != null)
        {
            shieldCicle.fillAmount = playerShield.ShieldAmount.Remap(0f, playerShield.maxShieldAmount, 0f, 1f);
            m_playerShield         = playerShield;
        }
        else
        {
            shieldCicle.gameObject.SetActive(false);
        }
    }
コード例 #11
0
ファイル: Customize.cs プロジェクト: SpaceSpaceSpace/Space
    private void EnterCustomization()
    {
        //Focus camera on player
        Camera cam = Camera.main;
        oldCameraSize = cam.orthographicSize;

        cam.orthographicSize = 1.5f;

        ship = PlayerShipScript.player;

        ship.Dock();
        CenterShip();

        PopulateAttachmentPoints();

        WeaponToggles.gameObject.SetActive(true);

        customizing = true;
    }
コード例 #12
0
ファイル: PlayerUI.cs プロジェクト: SpaceSpaceSpace/Space
    void Start()
    {
        EventManager.AddEventListener( EventDefs.PLAYER_HEALTH_UPDATE, UpdateHealth );
        EventManager.AddEventListener( EventDefs.PLAYER_SHIELD_UPDATE, UpdateShield );

        playerShip = PlayerShipScript.player;
        healthCicle.fillAmount = playerShip.MaxHealth/100f;
        ShieldScript playerShield = playerShip.Shield;

        if( playerShield != null )
        {
            shieldCicle.fillAmount = playerShield.ShieldAmount.Remap(0f,playerShield.maxShieldAmount,0f,1f);
            m_playerShield = playerShield;
        }
        else
        {
            shieldCicle.gameObject.SetActive( false );
        }
    }
コード例 #13
0
    //Eventually will spawn objectives based off contract
    public void SpawnContract(PlayerShipScript player)
    {
        GameObject contractObjective1 = (GameObject)GameObject.Instantiate(player.objectivePrefab, objectivePosition, Quaternion.identity);

        contractObjective1.GetComponent <ObjectiveEvent> ().ObjectiveContract = this;
        contractObjective1.GetComponent <ObjectiveEvent> ().init(ObjectiveEvent.ObjectiveType.KillTarget);
        SetUIMarker(contractObjective1);

        GameObject contractObjective2 = (GameObject)GameObject.Instantiate(player.objectivePrefab, objectivePosition, Quaternion.identity);

        contractObjective2.GetComponent <ObjectiveEvent> ().ObjectiveContract = this;
        contractObjective2.GetComponent <ObjectiveEvent> ().init(ObjectiveEvent.ObjectiveType.TurnInContract);
        contractObjective2.SetActive(false);

        contractObjective1.GetComponent <ObjectiveEvent> ().NextObjective = contractObjective2;

        contractObjectives.Add(contractObjective1);
        contractObjectives.Add(contractObjective2);
    }
コード例 #14
0
ファイル: Customize.cs プロジェクト: Honeybunch/Space
    private void EnterCustomization()
    {
        //Focus camera on player
        Camera cam = Camera.main;

        oldCameraSize = cam.orthographicSize;

        cam.orthographicSize = 1.5f;

        ship = PlayerShipScript.player;

        ship.Dock();
        CenterShip();

        PopulateAttachmentPoints();

        WeaponToggles.gameObject.SetActive(true);

        customizing = true;
    }
コード例 #15
0
ファイル: canvasScript.cs プロジェクト: highnet/C-
    void fetchShipReferences()
    {
        if (playerShip == null)
        { // canvas waits until the player ship spawns
            playerShip = GameObject.Find("Player Ship (Sloop)(Clone)");
            if (playerShip == null)
            {
                playerShip = GameObject.Find("Player Ship (Frigate)(Clone)");
            }
            if (playerShip != null)
            {
                playerShipScript = playerShip.GetComponent <PlayerShipScript>();
            }
        }

        if (controlScript.activeEnemyShipEngagedReference != null)
        {
            enemyAIShipScript = controlScript.activeEnemyShipEngagedReference.GetComponent <shipAIScriptTugboat>();
        }
    } // fetch all ship references
コード例 #16
0
ファイル: PlayerShipScript.cs プロジェクト: Honeybunch/Space
    void Awake()
    {
        player = this;

        m_alive = true;

        InitShip();

        // The camera is parented to a GO and offset on the Z axis
        // We're keeping the parent so we don't have to set the Z when moving the camera
        m_cameraTransform = Camera.main.transform.parent;
    }
コード例 #17
0
 // Start is called before the first frame update
 void Start()
 {
     MyText = GetComponent <Text>();
     PSS    = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerShipScript>();
 }
コード例 #18
0
ファイル: Contract.cs プロジェクト: Honeybunch/Space
    //Eventually will spawn objectives based off contract
    public void SpawnContract(PlayerShipScript player)
    {
        GameObject contractObjective1 = (GameObject)GameObject.Instantiate (player.objectivePrefab, objectivePosition, Quaternion.identity);
        contractObjective1.GetComponent<ObjectiveEvent> ().ObjectiveContract = this;
        contractObjective1.GetComponent<ObjectiveEvent> ().init (ObjectiveEvent.ObjectiveType.KillTarget);
        SetUIMarker (contractObjective1);

        GameObject contractObjective2 = (GameObject)GameObject.Instantiate (player.objectivePrefab, objectivePosition, Quaternion.identity);
        contractObjective2.GetComponent<ObjectiveEvent> ().ObjectiveContract = this;
        contractObjective2.GetComponent<ObjectiveEvent> ().init (ObjectiveEvent.ObjectiveType.TurnInContract);
        contractObjective2.SetActive (false);

        contractObjective1.GetComponent<ObjectiveEvent> ().NextObjective = contractObjective2;

        contractObjectives.Add (contractObjective1);
        contractObjectives.Add (contractObjective2);
    }