コード例 #1
0
ファイル: MissilePowerUp.cs プロジェクト: Ya-dola/Unity
    public override void ActivatePowerUp(StarshipController pickerStarship)
    {
        GameObject missile = Instantiate(missilePrefab);

        missile.transform.position = pickerStarship.transform.position + distance * pickerStarship.transform.right * -1f;
        missile.GetComponent <MissileBehavior>().SetAttributes(pickerStarship);
    }
コード例 #2
0
ファイル: GameController.cs プロジェクト: torybash/Gamma
    // Use this for initialization
    void Start()
    {
        ship         = GetComponentInChildren <StarshipController>();
        gui          = GetComponent <GUIController>();
        frontMessage = GetComponentInChildren <FrontMessage>();
        mainTimer    = GetComponentInChildren <MainTimer>();
        bar          = GetComponentInChildren <Bar>();
        speedCounter = GetComponentInChildren <SpeedCounter>();
        oobAudio     = GetComponentInChildren <OutOfBoundsAudio>();
        fuelAlarm    = GetComponentInChildren <FuelAlarm>();
        lowFuelText  = GetComponentInChildren <LowFuelText>();

        timeLeft     = 10f;     //!!!!
        currentSpeed = minimumSpeed;
        fuel         = 100f;

        theLevel = GetComponent <TheLevel>();


        foreach (Transform child in transform)
        {
            if (child.name == "StarsNear")
            {
                starsNear = child.GetComponent <Stars>();
            }
            else if (child.name == "StarsMedium")
            {
                starsMedium = child.GetComponent <Stars>();
            }
            else if (child.name == "StarsFar")
            {
                starsFar = child.GetComponent <Stars>();
            }
        }
    }
コード例 #3
0
    void FixedUpdate()
    {
        //Score
        Target_GameObject = GameObject.FindGameObjectWithTag("Player");
        starship_Script   = Target_GameObject.GetComponent <StarshipController>();

        //Death
        if (healthE < 0)
        {
            starship_Script.score_Starship += 20;
            Destroy(this.gameObject);
        }

        ////Rotation to look Player
        Target             = GameObject.FindGameObjectWithTag("Player").transform;
        lookDirection      = Target.position - transform.position;
        lookAngle          = Mathf.Atan2(lookDirection.y, lookDirection.x) * Mathf.Rad2Deg;
        transform.rotation = Quaternion.Euler(0f, 0f, lookAngle - 90f);

        ////Player detection
        distanceEP = Vector2.Distance(transform.position, Target.position);

        //Walled
        walled = Physics.CheckSphere(transform.position, wallDistance, wallMask);

        //Raycast
        rayVector = new Vector3((Target.position.x - transform.position.x), (Target.position.y - transform.position.y));
        enemyhit  = Physics2D.Raycast(Barrel.position, rayVector);
        Debug.DrawRay(transform.position, rayVector, Color.green);

        if (enemyhit.transform.tag == "Player" && !walled)
        {
            //Movimiento
            if (distanceEP > customdistanceEP)
            {
                transform.position = Vector2.MoveTowards(transform.position, Target.position, 1.5f * Time.deltaTime);
            }

            //Disparo
            if (distanceEP <= customdistanceEP)
            {
                if (crono <= cronoL)
                {
                    FiredBullet(Bullet);
                    crono = starship_Script.score_Starship * 0.01f;
                }
                else if (crono > cronoL)
                {
                    crono -= 1 * Time.deltaTime;
                }
            }
        }
        else
        {
            transform.position = Vector2.MoveTowards(transform.position, Target.position, 1.5f * Time.deltaTime);
        }
    }
コード例 #4
0
    void Awake()
    {
        //Fire
        customdistanceEP = 34;
        crono            = 1;
        cronoL           = 2;

        //Score
        Target_GameObject = GameObject.FindGameObjectWithTag("Player");
        starship_Script   = Target_GameObject.GetComponent <StarshipController>();
    }
コード例 #5
0
ファイル: PowerUp.cs プロジェクト: Ya-dola/Unity
 protected void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "starship")
     {
         AudioManagerForOneGame.am.PlaySound(nameSoundEffect);
         ParticleSystem particle = Instantiate(pickedParticle);
         particle.transform.position = transform.position;
         particle.Play();
         StarshipController pickerStarship = collision.gameObject.GetComponent <StarshipController>();
         ActivatePowerUp(pickerStarship);
         Destroy(gameObject);
     }
 }
コード例 #6
0
    public void Kill(GameObject starship)
    {
        Camera.main.GetComponent <CameraShake>().AskShake();
        AudioManagerForOneGame.am.PlaySound("Explosion");
        StarshipController controller = starship.transform.GetComponent <StarshipController>();

        GivaHalfStar(controller);
        ParticleSystem deathP = Instantiate(deathParticle, starship.transform.position, Quaternion.identity);

        deathP.Play();
        starship.SetActive(false);
        StartCoroutine(Respawn(starship, controller.spawnPos, controller.spawnRot));
    }
コード例 #7
0
    public void SetStarship(StarshipController ship)
    {
        starShip = ship;
        Prefs prefs = ship.prefs;

        Renderer[] renderers = transform.GetComponentsInChildren <Renderer> ();
        Color      c         = Color.HSVToRGB(prefs.colorHue, prefs.colorSaturation, prefs.colorLuminance);

        foreach (Renderer renderer in renderers)
        {
            renderer.material.SetColor("_Color", c);
        }
    }
コード例 #8
0
    private void GivaHalfStar(StarshipController killed)
    {
        StarshipController other = killed.otherStarship.GetComponent <StarshipController>();
        int toGive;

        if (killed.pointManager.points % 2 != 0)
        {
            toGive = (killed.pointManager.points + 1) / 2;
        }
        else
        {
            toGive = killed.pointManager.points / 2;
        }
        other.pointManager.AddPoints(toGive);
        killed.pointManager.RemovePoints(toGive);
    }
コード例 #9
0
        static async Task ProgramStart()
        {
            InitializeClient();
            string               input     = "";
            List <PersonModel>   people    = new List <PersonModel>();
            List <PlanetModel>   planets   = new List <PlanetModel>();
            List <VehicleModel>  vehicles  = new List <VehicleModel>();
            List <StarshipModel> starships = new List <StarshipModel>();
            List <SpeciesModel>  species   = new List <SpeciesModel>();
            List <FilModel>      films     = new List <FilModel>();

            input = StartMenu();

            try
            {
                switch (input.ToLower())
                {
                case "a":
                    people = await CharacterController.GetAllPeople();

                    await CharacterController.DisplayAllCharacters(people);

                    break;

                case "b":
                    planets = await PlanetController.GetAllPlanets();

                    await PlanetController.DisplayAllPlanets(planets);

                    break;

                case "c":
                    vehicles = await VehicleController.GetAllVehicles();

                    await VehicleController.DisplayAllVehicles(vehicles);

                    break;

                case "d":
                    starships = await StarshipController.GetAllStarships();

                    await StarshipController.DisplayAllStarships(starships);

                    break;

                case "e":
                    species = await SpeciesController.GetAllSpecies();

                    await SpeciesController.DisplayAllSpecies(species);

                    break;

                case "f":
                    films = await FilmController.GetAllFilms();

                    await FilmController.DisplayAllFilms(films);

                    break;

                default:
                    Console.WriteLine("Invalid input");
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: { ex.Message }");
            }
        }
コード例 #10
0
 public override void ActivatePowerUp(StarshipController pickerStarship)
 {
     pickerStarship.outlineSR.color = Color.red;
     pickerStarship.deathTouchOn    = true;
 }
コード例 #11
0
 public override void ActivatePowerUp(StarshipController pickerStarship)
 {
     pickerStarship.outlineSR.color = Color.green;
     pickerStarship.shipSpeed       = newSpeed;
 }
コード例 #12
0
 void Awake()
 {
     score_Text        = GetComponent <Text>();
     player_Gameobject = GameObject.FindGameObjectWithTag("Player");
     starship_Script   = player_Gameobject.GetComponent <StarshipController>();
 }
コード例 #13
0
 public void SetAttributes(StarshipController picker)
 {
     targetStarship = picker.otherStarship.GetComponent <StarshipController>();
     deathManager   = targetStarship.deathManager;
 }
コード例 #14
0
ファイル: PowerUp.cs プロジェクト: Ya-dola/Unity
 public abstract void ActivatePowerUp(StarshipController pickerStarship);
コード例 #15
0
ファイル: InputController.cs プロジェクト: torybash/Gamma
 // Use this for initialization
 void Start()
 {
     ship = GetComponentInChildren <StarshipController>();
 }
コード例 #16
0
 public override void ActivatePowerUp(StarshipController pickerStarship)
 {
     pickerStarship.pointManager.AddPoints(1);
 }