コード例 #1
0
        private void UpdateShieldRange(int sliderIndex)
        {
            ShieldController       shieldController       = Service.Get <ShieldController>();
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            BuildingTypeVO         maxLevel = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup);
            int num  = shieldController.PointsToRange[this.buildingInfo.ShieldRangePoints];
            int num2 = shieldController.PointsToRange[maxLevel.ShieldRangePoints];

            this.sliders[sliderIndex].CurrentSlider.Value = ((num2 == 0) ? 0f : ((float)num / (float)num2));
            if (this.useUpgradeGroup)
            {
                BuildingTypeVO nextLevel = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
                int            num3      = shieldController.PointsToRange[nextLevel.ShieldRangePoints];
                this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(num);
                this.sliders[sliderIndex].NextLabel.Text    = this.lang.Get("PLUS", new object[]
                {
                    this.lang.ThousandsSeparated(num3 - num)
                });
                this.sliders[sliderIndex].NextSlider.Value = ((num2 == 0) ? 0f : ((float)num3 / (float)num2));
                return;
            }
            this.sliders[sliderIndex].CurrentLabel.Text = this.lang.Get("FRACTION", new object[]
            {
                this.lang.ThousandsSeparated(num),
                this.lang.ThousandsSeparated(num2)
            });
        }
コード例 #2
0
        private void UpdateShieldHealth(int sliderIndex)
        {
            ShieldController       shieldController       = Service.ShieldController;
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;
            BuildingTypeVO         maxLevel = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup);
            int num  = shieldController.PointsToHealth[this.buildingInfo.ShieldHealthPoints];
            int num2 = shieldController.PointsToHealth[maxLevel.ShieldHealthPoints];

            this.sliders[sliderIndex].CurrentSlider.Value = ((num2 != 0) ? ((float)num / (float)num2) : 0f);
            if (this.useUpgradeGroup)
            {
                BuildingTypeVO nextLevel = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
                int            num3      = shieldController.PointsToHealth[nextLevel.ShieldHealthPoints];
                this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(num);
                this.sliders[sliderIndex].NextLabel.Text    = this.lang.Get("PLUS", new object[]
                {
                    this.lang.ThousandsSeparated(num3 - num)
                });
                this.sliders[sliderIndex].NextSlider.Value = ((num2 != 0) ? ((float)num3 / (float)num2) : 0f);
            }
            else
            {
                this.sliders[sliderIndex].CurrentLabel.Text = this.lang.Get("FRACTION", new object[]
                {
                    this.lang.ThousandsSeparated(num),
                    this.lang.ThousandsSeparated(num2)
                });
            }
        }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     cam              = Camera.main;
     moveDirection.y  = 0;
     shieldHealth     = gm.GetPlayerShield();
     shieldController = shield.GetComponent <ShieldController>();
 }
コード例 #4
0
	protected override void OnShieldKnockBack(ShieldController target) {
		if (player.facingRight ()) {
			target.Knockback (new Vector2 (1, 0), shieldKnockback);
		} else {
			target.Knockback (new Vector2 (-1, 0), shieldKnockback);
		}
	}
コード例 #5
0
 public void SetShieldController(ShieldController sc)
 {
     if (sc != null)
     {
         shield = sc;
     }
 }
コード例 #6
0
ファイル: GameManager.cs プロジェクト: Xsce-sk/SpaceInvaders
    void Start()
    {
        m_Transform         = transform;
        m_CameraTransform   = Camera.main.transform;
        m_PlayerTransform   = GameObject.FindGameObjectWithTag("Player").transform;
        m_EnemiesTransform  = GameObject.FindGameObjectWithTag("Enemies").transform;
        m_ShieldsTransform  = GameObject.FindGameObjectWithTag("Shields").transform;
        m_InGameUITransform = m_Transform.GetChild(3);

        m_PlayerController = m_PlayerTransform.gameObject.GetComponent <PlayerController>();
        m_EnemyController  = m_EnemiesTransform.gameObject.GetComponent <EnemyController>();
        m_ShieldController = m_ShieldsTransform.gameObject.GetComponent <ShieldController>();
        m_LivesText        = GetComponentInChildren <LivesText>();
        m_ScoreText        = GetComponentInChildren <ScoreText>();
        m_LevelText        = GetComponentInChildren <LevelText>();

        m_OriginalCameraPosition = m_CameraTransform.position;
        m_StartMenu       = m_Transform.GetChild(0).gameObject;
        m_GameOverMenu    = m_Transform.GetChild(1).gameObject;
        m_PauseMenu       = m_Transform.GetChild(2).gameObject;
        m_InGameUI        = m_Transform.GetChild(3).gameObject;
        m_ExplosionPrefab = Resources.Load <GameObject>("Prefabs/Explosion");

        m_CanPause = false;
        DisableInGameUI();
    }
コード例 #7
0
    public void Initialise(IComponentController shield)
    {
        Shield               = (ShieldController)shield;
        ShieldNameLabel      = transform.Find("ShieldName").GetComponent <Text>();
        ShieldNameLabel.text = Shield.Name;

        TargetButton = transform.Find("TargetButton").GetComponent <Button>();
        TargetButton.onClick.AddListener(StartTargeting);

        ArcButton = transform.Find("ArcButton").GetComponent <Button>();
        ArcButton.onClick.AddListener(ToggleArc);

        DirectionSlider = transform.Find("DirectionSlider").GetComponent <Slider>();
        DirectionSlider.onValueChanged.AddListener(SetDirection);
        DirectionSlider.value        = Shield.GetRotationProportion();
        DirectionSlider.interactable = (Shield.GetTarget() == null);

        RechargeToggle      = transform.Find("RechargeToggle").GetComponent <Toggle>();
        RechargeToggle.isOn = Shield.Recharging;
        RechargeToggle.onValueChanged.AddListener(SetRecharging);


        // store text color so we can set back
        labelColor  = ShieldNameLabel.color;
        buttonColor = TargetButton.GetComponentInChildren <Text>().color;
    }
コード例 #8
0
    /**
     * For specific frame where player will throw the shield
     */
    private void ThrowShield()
    {
        ShieldController shield    = GameObject.Find("shield").GetComponent <ShieldController>();
        Vector3          direction = Camera.main.transform.forward;

        Camera.main.transform.GetComponent <ThirdPersonCamera>().AimOff();
        shield.Thrown(direction.normalized);
    }
コード例 #9
0
	protected override void OnShieldKnockBack(ShieldController target) {
		Vector2 launchDirection = target.transform.position - player.getTransform ().position;
		if (launchDirection.x >= 0) {
			target.Knockback (new Vector2 (1, 0), shieldKnockback);
		} else {
			target.Knockback (new Vector2 (-1, 0), shieldKnockback);
		}
	}
コード例 #10
0
 private void Awake()
 {
     // player는 계속 같은 자리에 존재하므로 Awake에서 Transform 가져온다.
     playerTransform = ShieldmanController.Instance.transform;
     // ??? 호출 너무 복잡...
     shield = ShieldmanController.Instance.gameObject.GetComponent <ShieldController>();
     rb     = gameObject.GetComponent <Rigidbody2D>();
 }
コード例 #11
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         gameObject.SetActive(false);
     }
 }
コード例 #12
0
 ////////////FUNCTIONS/////////
 private void GetAllReferences()
 {
     // Finds references
     myRigidbody        = GetComponent <Rigidbody2D>();
     myAnimator         = transform.GetComponentInChildren <Animator>();
     myShield           = gameObject.transform.Find("Shield").gameObject;
     myShieldController = myShield.GetComponent <ShieldController>();
     myDeathExplosion   = gameObject.transform.Find("DeathExplosion").gameObject;
 }
コード例 #13
0
 void Update()
 {
     if (gameObject.CompareTag("Shield") && shieldTimer != null)
     {
         lifetime        -= Time.deltaTime;
         shieldController = gameObject.GetComponent <ShieldController> ();
         shieldTimer.text = "Shield : " + (int)lifetime + " seconds or " + shieldController.countUntillDestroy + " times";
     }
 }
コード例 #14
0
 //Assigns skill values to shields
 private void ConfigureShield(ShieldController bc)
 {
     if (shieldHP == 0)
     {
         print("Check your shield HP value!  might be 0!");
     }
     bc.maxHP = shieldHP;
     //bc.regenRate = shieldRegen; //commented out since regen rate doesn't vary, according to joe
 }
コード例 #15
0
 void Start()
 {
     gameController   = GameController.instance;
     shieldController = GetComponentInChildren <ShieldController>();
     currentWeapon    = weapons[Random.Range(0, weapons.Length)];
     //currentWeapon = weapons[4];
     gameController.SetFirerate(currentWeapon.fireRate);
     gameController.SetTimer(currentWeapon.weaponColor, currentWeapon.timeToChange);
 }
コード例 #16
0
    void Start()
    {
        Debug.Log("PlayerStart()");
        playerRb    = GetComponent <Rigidbody> ();
        playerTrans = GetComponent <Transform> ();

        speed                 = .75f;
        jumpPower             = 1050.0f;
        jumpThreshold         = 0.75f;
        fallOffValue          = 5.0f;
        groundColliderContact = false;
        shootDirection        = Vector3.left;

        health    = 100;
        maxHealth = 100;

        playerShield        = gameObject.GetComponent <ShieldController> ();
        playerShield.player = gameObject.GetComponent <PlayerController> ();

        playerMaterial = gameObject.GetComponent <MeshRenderer> ().material;
        baseColor      = playerMaterial.color;

        playerGunController = gameObject.GetComponent <GunController> ();
        playerBombs         = gameObject.GetComponent <BombController> ();

        cameraShake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShaker> ();

        input = GameController.Instance.GetComponent <InputController> ();
        Debug.Log("Setting Controllers...");
        input.SetGunController(playerGunController);
        input.SetShieldController(playerShield);
        input.SetBombController(playerBombs);
        //input.UpdateControllers ();

        Debug.Log("Finished setting Controllers.");

        GameObject audioObject = GameObject.FindGameObjectWithTag("AudioController");

        Debug.Log(audioObject);
        if (audioObject != null)
        {
            Debug.Log("Found the audioObject!");
            AudioSource[] audioSources = audioObject.GetComponents <AudioSource> ();
            spawnSound  = audioSources [0];
            damageSound = audioSources [1];
            shotSound   = audioSources [2];
            deathSound  = audioSources [3];
            shieldSound = audioSources [4];
            bombSound   = audioSources [5];
            spawnSound.Play();
        }
        else
        {
            Debug.Log("Well, we never found the audioObject.");
        }
    }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     sm = new ShieldModel();
     sv = new ShieldView();
     sv.SetModel(sm);
     sv.SetUiText(TextShieldStrengthValue, TextRepairableValue);
     sv.Refresh();
     sc = new ShieldController();
     sc.SetModel(sm);
     sc.SetView(sv);
 }
コード例 #18
0
    private float ShieldActiveCD = 15f; //Cooldown before shields restart

    #endregion Fields

    #region Methods

    void Start()
    {
        EC = GetComponent<EnemyController>();
        Shield = GetComponentInChildren<ShieldController>();
        HC = GetComponent<HealthController>();
        EBS = GetComponent<LMEnergyBallShot>();

        IC = GameObject.FindGameObjectWithTag("Player").GetComponent<InventoryController>();
        P = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
        floor = P.getCurrentFloor() + 1;
    }
コード例 #19
0
 protected override void OnShieldKnockBack(ShieldController target)
 {
     if (player.facingRight())
     {
         target.Knockback(new Vector2(-1, 0), shieldKnockback);
     }
     else
     {
         target.Knockback(new Vector2(1, 0), shieldKnockback);
     }
 }
コード例 #20
0
    public void Create(Ship ship)
    {
        // instantiate the ship prefab
        var shipClone = Instantiate(_chassisPrefabs[ship.ChassisType]);

        shipClone.gameObject.name = ship.Name;
        ShipController shipController = shipClone.GetComponent <ShipController>();

        shipController.InitializeFromStruct(ship, _chassisTypes[ship.ChassisType]);

        // initialise power plant
        PowerController powerController = shipClone.GetComponentInChildren <PowerController>();

        powerController.InitializeFromStruct(ship.PowerPlant, _powerPlantTypes[ship.PowerPlant.PowerPlantType]);

        // instantiate each shield
        foreach (Shield shield in ship.Shields)
        {
            var shieldClone = Instantiate(_shieldPrefabs[shield.ShieldType]);
            ShieldController shieldController = shieldClone.GetComponent <ShieldController>();
            shieldController.InitialiseFromStruct(shield, _shieldTypes[shield.ShieldType]);

            // attach to the right hardpoint -- TODO add checking here that the hardpoint exists
            var hardpoint = shipClone.transform.Find(shield.HardpointName);
            shieldClone.SetParent(hardpoint, false);
        }

        // instantiate each weapon
        foreach (Weapon weapon in ship.Weapons)
        {
            var weaponClone = Instantiate(_weaponPrefabs[weapon.WeaponType]);
            WeaponController weaponController = weaponClone.GetComponent <WeaponController>();
            weaponController.InitialiseFromStruct(weapon, _weaponTypes[weapon.WeaponType]);

            // attach to the right hardpoint -- TODO add checking here that the hardpoint exists
            var hardpoint = shipClone.transform.Find(weapon.HardpointName);
            weaponClone.SetParent(hardpoint, false);
        }


        // instantiate offscreen indicator
        var offscreenIndicatorClone = Instantiate(OffscreenIndicatorPrefab);
        OffscreenIndicatorController offscreenIndicatorController = offscreenIndicatorClone.GetComponent <OffscreenIndicatorController>();

        offscreenIndicatorController.Target = shipClone;
        offscreenIndicatorClone.SetParent(OffscreenIndicatorParent);
        shipController.OffscreenIndicator = offscreenIndicatorController;

        // set the layer
        int layer = ship.Faction == "Friendly" ? GameManager.PLAYER_LAYER : GameManager.ENEMY_LAYER;

        shipClone.gameObject.SetLayer(layer);
    }
コード例 #21
0
    private void Start()
    {
        controller = gameObject.GetComponent <EnemyController>();
        controller.SetCurrentHealth(maxHealth);
        controller.SetMaxHealth(maxHealth);
        player  = GameObject.FindGameObjectWithTag("Player");
        shield  = player.transform.gameObject.GetComponent <ShieldController>();
        run_spd = gameObject.transform.parent.GetComponent <FrontViewMove>().GetFrontViewSpeed() * 3f;

        animator       = gameObject.GetComponent <Animator>();
        parachute_anim = gameObject.transform.GetChild(0).gameObject.GetComponent <Animator>();
    }
コード例 #22
0
    private void Start()
    {
        //model
        ShieldModel model = new ShieldModel();

        //view
        ShieldView view = new ShieldView();

        //controller
        ShieldController controller = new ShieldController();

        view.SetUITexts(model.GetStrength(), model.IsRepairable());
    }
コード例 #23
0
ファイル: EnergyPickup.cs プロジェクト: ArkInRev/LD46
    // Start is called before the first frame update
    void Start()
    {
        gm         = GameManager.instance;
        player     = GameObject.FindWithTag("Player");
        energyGain = gm.GetEnergyGain();
        sc         = player.GetComponent <PlayerController>().shieldGO.GetComponent <ShieldController>();

        initialParent = gameObject.transform.parent;

        spawnParentGO  = GameObject.FindWithTag("MapGOTagger");
        goInstantiated = initialParent.gameObject;
        goInstantiated.transform.SetParent(spawnParentGO.transform);
    }
コード例 #24
0
    private void Start()
    {
        model = new ShieldModel();

        view = new ShieldView();
        view.SetModel(model);
        view.SetText(Strength, isRepairable);
        view.TextAfterChanges();

        controller = new ShieldController();
        controller.SetModel(model);
        controller.SetView(view);
    }
コード例 #25
0
ファイル: Alien.cs プロジェクト: pontiaj2066/earth-invaders
    public void RemovePlayer()
    {
        Destroy(GetComponent <PlayerController>());
        tag = "Alien";
        GetComponent <SpriteRenderer>().color = color;
        Move(new Vector3(0, 0, 0));
        ShieldController shieldController = GetComponent <ShieldController>();

        if (shieldController)
        {
            shieldController.PlayerDetached();
        }
    }
コード例 #26
0
 /**
  * What happens on start frame
  *
  * Gathers all components that are needed and initializes the object
  */
 private void Start()
 {
     input              = GameObject.Find("InputController").GetComponent <InputController>();
     m_AnimFlags        = gameObject.GetComponentInChildren <PlayerAnimationFlags>();
     m_Anim             = gameObject.GetComponentInChildren <Animator>();
     m_Camera           = Camera.main;
     m_Stats            = GetComponent <Stats>();
     m_ShieldController = GameObject.Find("shield").GetComponent <ShieldController>();
     m_LeftFist         = GameObject.Find("LeftFist").transform;
     m_RightFist        = GameObject.Find("RightFist").transform;
     m_Foot             = GameObject.Find("LeftFoot").transform;
     m_ShieldPoint      = GameObject.Find("ShieldPoint").transform;
 }
コード例 #27
0
    private void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        shield = player.transform.gameObject.GetComponent <ShieldController>();
        // run_spd = gameObject.transform.parent.GetComponent<FrontViewMove>().GetFrontViewSpeed() * 2f;
        run_spd = 600f; // front move speed X 2

        animator       = gameObject.GetComponent <Animator>();
        parachute_anim = gameObject.transform.GetChild(1).gameObject.GetComponent <Animator>();

        // initial fire time is random
        count = Random.Range(0.5f, 1.5f);
    }
コード例 #28
0
    protected override void OnShieldKnockBack(ShieldController target)
    {
        Vector2 launchDirection = target.transform.position - player.getTransform().position;

        if (launchDirection.x >= 0)
        {
            target.Knockback(new Vector2(1, 0), shieldKnockback);
        }
        else
        {
            target.Knockback(new Vector2(-1, 0), shieldKnockback);
        }
    }
コード例 #29
0
    private void Start()
    {
        startTime = Time.time;
        player    = GameObject.FindGameObjectWithTag("Player");
        rb        = gameObject.GetComponent <Rigidbody2D>();
        animator  = gameObject.GetComponent <Animator>();
        shield    = player.GetComponent <ShieldController>();

        // setting bezier points
        points[0] = gameObject.transform.position + new Vector3(-50f, 0, 0);
        points[1] = gameObject.transform.position + new Vector3(-500f, height, 0);
        points[2] = player.transform.position + new Vector3(200f, height, 0);
        points[3] = player.transform.position;
    }
コード例 #30
0
    // Use this for initialization
    void Start()
    {
        model = new ShieldModel();

        view = new ShieldView();
        view.SetModel(model);
        view.SetUIItems(textStrength, textRepair, imageShield);
        view.SetImages(images);
        view.Refresh();


        controller = new ShieldController();
        controller.SetModel(model);
        controller.SetView(view);
    }
コード例 #31
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.GetComponent <ShieldController>() != null)
        {
            ShieldController shield = other.gameObject.GetComponent <ShieldController>();

            if (shield.ShieldLevel == 0)
            {
                return;
            }

            shield.AbsorbDamage(1000); //damage amount big enougth to drop down shield level
            TakeDamage(1000);
        }
    }
コード例 #32
0
    private void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").gameObject;

        shield = player.GetComponent <ShieldController>(); // 나중에 구조 바꿀것
        rb     = gameObject.GetComponent <Rigidbody2D>();

        Vector3 dir = player.transform.position - gameObject.transform.position;

        rb.velocity = dir.normalized * speed;

        float angle = Mathf.Atan2(rb.velocity.y, rb.velocity.x) * Mathf.Rad2Deg;

        transform.rotation = Quaternion.AngleAxis(angle - 180, Vector3.forward);
    }
コード例 #33
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.GetComponent <ShieldController>() != null)
     {
         ShieldController shield = other.gameObject.GetComponent <ShieldController>();
         if (shield.ShieldLevel == 0)
         {
             return;
         }
         else
         {
             shield.AbsorbDamage(damagePower);
             DeactivateProjectile();
         }
     }
 }
コード例 #34
0
ファイル: TutorialEventManager.cs プロジェクト: njunius/Inure
    // Update is called once per frame
    void FixedUpdate()
    {
        if (gameController == null)
        {
            gameController = GameObject.FindGameObjectWithTag("GameController");
            im = gameController.GetComponent<InputManager>();
        }

        if (player != null)
        {

            if (eventTimer > 0)
            {
                eventTimer--;
                if (eventTimer == 0)
                {
                    eventIndex++;
                    refresh();
                }
            }

            switch (eventIndex)
            {
                case 0:
                    if (!dialogueSource.isPlaying)
                    {
                        eventIndex++;
                        refresh();
                    }
                    break;
                case 8:
                    if (door1Upper.GetComponent<TutorialDoors>().open)
                    {
                        eventIndex++;
                        refresh();
                    }
                    break;
            }

        }
        else if (GameObject.FindGameObjectWithTag("Player") != null)
        {
            player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
            player.freezeRotation();
            player.rotateEnabled = false;
            player.verticalEnginesEnabled = false;
            player.longitudinalEnginesEnabled = false;
            player.lateralEnginesEnabled = false;
            player.weaponsEnabled = false;
            player.shieldEnabled = false;
            shield = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren<ShieldController>();

        }
    }
コード例 #35
0
ファイル: HitBox.cs プロジェクト: andrewpk95/CS492Week4-5
	protected virtual void OnShieldKnockBack(ShieldController target) {
		
	}
コード例 #36
0
 // Use this for initialization
 void Start()
 {
     Shield = GetComponentInChildren<ShieldController>();
 }
コード例 #37
0
 void Awake()
 {
     current_health = max_health;
     Shield = GetComponentInChildren<ShieldController>();
     AHC = GetComponentInChildren<AttackHit>();
     if (Shield != null)
         HasShield = true;
 }
コード例 #38
0
ファイル: PlayerController.cs プロジェクト: njunius/Inure
    // Use this for initialization
    void Awake()
    {
        Cursor.lockState = CursorLockMode.Confined;
        audio_bullet = GetComponents<AudioSource>()[0];   //0: bullets, 1: engines, 2: shield, 3: impacts, 4: other
        audio_engineHum = GetComponents<AudioSource>()[1];

        audio_engineHum.enabled = true;
        audio_engineHum.Play();
        audio_accellerators = GetComponents<AudioSource>()[2];
        audio_thrusters = GetComponents<AudioSource>()[3];
        audio_hullHit = GetComponents<AudioSource>()[4];
        audio_wallImpact = GetComponents<AudioSource>()[5];
        audio_effects = GetComponents<AudioSource>()[6];
        audio_bomb = GetComponents<AudioSource>()[7];
        audio_accellerators_max_vol = audio_accellerators.volume;
        audio_thrusters_max_vol = audio_thrusters.volume;
        Time.timeScale = 1; // The time scale must be reset upon loading from the main menu

        rb = GetComponent<Rigidbody>();
        originalColor = mesh.GetComponent<Renderer>().material.color;

        curPowerUp = powerUpList[0];

        shield = GetComponentInChildren<ShieldController>();
        bomb = GetComponentInChildren<BombController> ();

        maxHullIntegrity = currHullIntegrity = 5;
        armorGauge = gameObject.GetComponentInChildren<ArmorController>();

        bombTimer = gameObject.GetComponentInChildren<BombCountdownController>();

        deathEndingTimer = 0.0f;
        sceneTransition = GameObject.FindGameObjectWithTag("Screen Transition").GetComponent<CanvasGroup>();
        transitionRate = 3;

        if (tutorialMode)
        {
            //Debug.Log("tutorial mode");
            currHullIntegrity = 0;
        }

        Transform[] temp = bulletSpawns.GetComponentsInChildren<Transform>();
        bulletSpawnLocations = new Transform[temp.Length - 1];
        bulletSpawnLocIndex = 0;
        for(int i = 0; i < temp.Length; ++i)
        {
            if(temp[i].gameObject.GetInstanceID() != bulletSpawns.GetInstanceID())
            {
                bulletSpawnLocations[bulletSpawnLocIndex] = temp[i];
                ++bulletSpawnLocIndex;
            }
        }

        if (GameObject.Find("GameController") == null)
        {
            Instantiate(gameController);
        }
        gameController = GameObject.FindGameObjectWithTag("GameController");
        im = gameController.GetComponent<InputManager>();

        mainThrusterLeft.Play ();
        mainThrusterRight.Play ();
    }
コード例 #39
0
    void Start()
    {
        //NEW CODE HERE
        GameObject shieldControllerObject = GameObject.FindWithTag("ShieldController");
        GameObject playerHealthObject = GameObject.FindWithTag("Health");
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");
        GameObject shotSpawnObject = GameObject.FindWithTag("ShotSpawn");
        GameObject camShakeControllerObject =
          GameObject.FindWithTag("MainCamera");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent<GameController>();
            camShake =
              camShakeControllerObject.GetComponent<cameraShake>();
        }
        if (playerHealthObject!=null)
        {
            playerHealth = playerHealthObject.GetComponent<PlayerHealth>();
        }
        if (shieldControllerObject != null)
        {
            shieldController = shieldControllerObject.GetComponent<ShieldController>();
        }
        if (shotSpawnObject != null)
        {
            shotSpawnController = shotSpawnObject.GetComponent<ShotSpawn>();
        }

        fileName = "shoot";
        file = new FileInfo(Application.persistentDataPath + "\\" + fileName + ".txt");
        //LoadShot();
        if (PlayerPrefs.HasKey("Shot"))
        {
            loadedFireType = PlayerPrefs.GetInt("Shot");
        }
        else
        {
            loadedFireType = 1;
        }

        fireType = loadedFireType;
        rigidBody = gameObject.GetComponent<Rigidbody2D>();
    }
コード例 #40
0
    //тип 6 номер 6
    public void Shieldcontroller(ShieldController sh, 
	                              RootCharacterController c,
	                              WeaponClass w,
	                              int n, int b,int cN,
	                              SpFunctions s,
	                              clavisher cl)
    {
        if (sh.stage == 0)
            sh.SetValues (c, w, n, b, cN, s, cl);
        sh.Work ();
    }
コード例 #41
0
 //Assigns skill values to shields
 private void ConfigureShield(ShieldController bc)
 {
     if (shieldHP == 0)
         print ("Check your shield HP value!  might be 0!");
     bc.maxHP = shieldHP;
     //bc.regenRate = shieldRegen; //commented out since regen rate doesn't vary, according to joe
 }