void OnTriggerEnter(Collider other)
 {
     // CollectResource Resource = (CollectResource)other.gameObject.GetComponent(typeof(CollectResource));
     ResourceCollisionHandling Player = (ResourceCollisionHandling)other.gameObject.GetComponent(typeof(ResourceCollisionHandling));
     Owner = Player.GetPlayer();
     StartCapturing();
 }
 // Use this for initialization
 void Start()
 {
     Player = GameObject.Find ("Player");
     resources = Player.GetComponent<PlayerResources>();
     //intial amount of resource given
     resCount = 10;
 }
Esempio n. 3
0
    //Create the overhead UI
    public void Overheads(string name, Color color)
    {
        this.prefab    = Resources.Load("Prefabs/Overheads") as GameObject;
        this.overheads = Instantiate(this.prefab).GetComponent <Overheads>();
        this.resources = this.overheads.resources;

        this.overheads.name   = name;
        this.overheads.color  = color;
        this.overheads.player = this;
    }
Esempio n. 4
0
        public FuelGenerator(Actor self, FuelGeneratorInfo info)
        {
            Info = info;

            var source = info.UseFuelReserve ? self.Owner.PlayerActor : self;

            fueltank  = source.Trait <Fueltank>();
            resources = self.Owner.PlayerActor.TraitOrDefault <PlayerResources>();
            ticks     = info.Interval;
        }
Esempio n. 5
0
 protected override void Created(Actor self)
 {
     // Special case handling is required for the Player actor.
     // Created is called before Player.PlayerActor is assigned,
     // so we must query player traits from self, which refers
     // for bot modules always to the Player actor.
     playerPower             = self.TraitOrDefault <PowerManager>();
     playerResources         = self.Trait <PlayerResources>();
     positionsUpdatedModules = self.TraitsImplementing <IBotPositionsUpdated>().ToArray();
 }
Esempio n. 6
0
        void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
        {
            // Unlink any harvesters
            foreach (var harv in GetLinkedHarvesters())
            {
                harv.Trait.UnlinkProc(harv.Actor, self);
            }

            playerResources = newOwner.PlayerActor.Trait <PlayerResources>();
        }
Esempio n. 7
0
 public BaseBuilder(HackyAI ai, string category, Player p, PowerManager pm, PlayerResources pr)
 {
     this.ai         = ai;
     world           = p.World;
     player          = p;
     playerPower     = pm;
     playerResources = pr;
     this.category   = category;
     failRetryTicks  = ai.Info.StructureProductionResumeDelay;
 }
        void INotifyCreated.Created(Actor self)
        {
            // Special case handling is required for the Player actor.
            // Created is called before Player.PlayerActor is assigned,
            // so we must query other player traits from self, knowing that
            // it refers to the same actor as self.Owner.PlayerActor
            var playerActor = self.Info.Name == "player" ? self : self.Owner.PlayerActor;

            playerResources = playerActor.Trait <PlayerResources>();
        }
Esempio n. 9
0
        /// <summary>
        /// Called when the attached Behaviour is destroying.
        /// </summary>
        private void OnDestroy()
        {
            movement?.Disable();
            ClearLastResourcesHero();

            if (!PlayerResources.IsNullOrMissing())
            {
                PlayerResources.OnNewSourceHero -= OnNewResourceHeroHandler;
            }
        }
Esempio n. 10
0
 void Awake()
 {
     PlayerManager = GameObject.Find("PlayerManager").GetComponentInChildren <PlayerResources>();
     goldAmount    = GameObject.Find("GoldText").GetComponent <Text>();
     foodAmount    = GameObject.Find("FoodText").GetComponent <Text>();
     swordAmount   = GameObject.Find("SwordText").GetComponent <Text>();
     axeAmount     = GameObject.Find("AxeText").GetComponent <Text>();
     gunnerAmount  = GameObject.Find("GunnerText").GetComponent <Text>();
     looterAmount  = GameObject.Find("LooterText").GetComponent <Text>();
 }
Esempio n. 11
0
        public ProductionQueue(Actor self, Actor playerActor, ProductionQueueInfo info)
        {
            this.self       = self;
            this.Info       = info;
            playerResources = playerActor.Trait <PlayerResources>();
            PlayerPower     = playerActor.Trait <PowerManager>();

            Race        = self.Owner.Country;
            Produceable = InitTech(playerActor);
        }
Esempio n. 12
0
 // Start is called before the first frame update
 void Start()
 {
     er          = GetComponent <EnemyResources>();
     rb          = GetComponent <Rigidbody2D>();
     player      = GameObject.FindGameObjectWithTag("Player");
     attackReady = false;
     pr          = player.GetComponent <PlayerResources>();
     anim        = GetComponent <Animator>();
     ps          = GetComponentInChildren <ParticleSystem>();
 }
Esempio n. 13
0
 void Start()
 {
     //Start the coroutine we define below named ExampleCoroutine.
     //StartCoroutine(ExampleCoroutine());
     playerTurn          = true;
     gameGrid            = GameObject.FindGameObjectWithTag("GridManager").GetComponent <TileMouseOver>();
     playerResources     = GetComponent <PlayerResources>();
     behaviourController = GetComponent <BehaviourController>();
     ticTac.SetActive(false);
 }
Esempio n. 14
0
 void Start()
 {
     _player           = GameObject.Find("Player");
     _playerResources  = _player.GetComponent <PlayerResources>();
     _playerExperience = _player.GetComponent <PlayerExperience>();
     resourceQuantity  = maxQuantity + Convert.ToInt32(UnityEngine.Random.Range(-maxQuantity * 0.3f, maxQuantity * 0.3f));
     _animator         = _player.GetComponent <Animator>();
     audioManager      = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <CustomAudioManager>();
     _playerEq         = _player.GetComponent <PlayerEquipment>();
 }
Esempio n. 15
0
 public SupportPowerBotASModule(Actor self, SupportPowerBotASModuleInfo info)
     : base(info)
 {
     world  = self.World;
     player = self.Owner;
     self.World.AddFrameEndTask(w =>
     {
         playerResource = player.PlayerActor.Trait <PlayerResources>();
     });
 }
    //Finds car's movement script ...
    private void Start()
    {
        carMovement      = GetComponentInParent <CarMovement>();
        playerResources  = GameObject.FindWithTag(PlayerTag).GetComponent <PlayerResources>();
        losingController = GameObject.FindWithTag(LosingControllerTag).GetComponent <LosingController>();

        speedTextOffPoint   = carMovement.Road.commonPath.GetControlPoint(15).z;
        checkResourcesPoint = carMovement.Road.commonPath.GetControlPoint(47).z;

        SetTextParameters();
    }
Esempio n. 17
0
    private void Die()
    {
        StartCoroutine(AnimatedDeath());

        GameObject      controller      = GameObject.Find("Game Control");
        PlayerResources resourceControl = controller.GetComponent <PlayerResources>();

        resourceControl.AddSpikes(spikeResource);
        resourceControl.AddCrawlbits(crawlResource);
        resourceControl.AddScrap(scrapResource);
    }
Esempio n. 18
0
    void UpdateResources()
    {
        currencyCount.text          = PlayerResources.GetCurrentCurrencyValue().ToString();
        buildingMaterialsCount.text = PlayerResources.GetCurrentBuildingMaterialsValue().ToString();
        toolPartsCount.text         = PlayerResources.GetCurrentToolPartsValue().ToString();
        bookPagesCount.text         = PlayerResources.GetCurrentBookPagesValue().ToString();

        felledTreesCount.text = HomesteadStockpile.GetTreesCountAsString();
        logsCount.text        = HomesteadStockpile.GetLogsCountAsString();
        firewoodCount.text    = HomesteadStockpile.GetFirewoodCountAsString();
    }
Esempio n. 19
0
    public void Start()
    {
        res = GameObject.FindObjectOfType <PlayerResources>();
        StartCoroutine("Cooldown");

        // Handle visuals

        GameObject.FindObjectOfType <WeaponVisController>().AddWeapon(weaponType);

        pool = GameObject.FindObjectOfType <PoolController>();
    }
Esempio n. 20
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag != "Player")
        {
            return;
        }

        GetComponent <MeshRenderer>().enabled = false;
        PlayerResources.CollectCoin();
        Destroy(gameObject);
    }
Esempio n. 21
0
    // Start is called before the first frame update
    void Start()
    {
        if (player == null)
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }
        if (scoutLocationsParent == null)
        {
            scoutLocationsParent = GameObject.FindGameObjectWithTag("ScoutLocations").transform;
        }
        if (fleeLocationsParent == null)
        {
            fleeLocationsParent = GameObject.FindGameObjectWithTag("FleeLocations").transform;
        }
        if (collider == null)
        {
            collider = GameObject.FindGameObjectWithTag("MainCamera").transform;
        }
        if (anim == null)
        {
            anim = GetComponent <Animator>();
        }
        if (spawner == null)
        {
            spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent <AISpawner>();
        }


        enemyResources = GetComponent <PlayerResources>();
        enemyResources.SetHealth(100);
        enemyBehaviour = EnemyBehaviours.Scouting;

        // Get nav mesh agent from gameobject
        enemyNavMeshAgent = GetComponent <NavMeshAgent>();

        // Add each scout point to scoutLocations list
        foreach (Transform child in scoutLocationsParent)
        {
            scoutLocations.Add(child);
        }

        // Add each flee point to fleeLocations list
        foreach (Transform child in fleeLocationsParent)
        {
            fleeLocations.Add(child);
        }

        // Assign first scout location
        int randomIndex = Random.Range(0, scoutLocations.Count);

        nextLocation = scoutLocations[randomIndex];

        //anim = GetComponent<Animator>();
    }
Esempio n. 22
0
    public void LoadMenu()
    {
        Time.timeScale = 1f;
        gameIsPaused   = false;

        // Dear future me, it's not the best idea to reset the game
        // state from the Pause Menu. Please think of something better,
        // regards, past (present?) me.
        PlayerResources.Reset();

        SceneManager.LoadScene("MainMenu");
    }
Esempio n. 23
0
 // Use this for initialization
 void Start()
 {
     desireability = 1;
     HouseLevel    = 1;
     Level2Model   = GameObject.FindGameObjectWithTag("Game Control").GetComponent <HouseModels> ().House2;
     Level3Model   = GameObject.FindGameObjectWithTag("Game Control").GetComponent <HouseModels> ().House3;
     PopManager    = GameObject.FindGameObjectWithTag("Game Control").GetComponent <PopulationManager>();
     ElapsedTime   = GameObject.FindGameObjectWithTag("Game Control").GetComponent <ElapsedTime>();
     discontent    = GameObject.FindGameObjectWithTag("Game Control").GetComponent <Discontent>();
     pResource     = GameObject.FindGameObjectWithTag("Game Control").GetComponent <PlayerResources>();
     prosp         = GameObject.FindGameObjectWithTag("Game Control").GetComponent <Prosperity>();
 }
Esempio n. 24
0
    public void AddPlayer(Vector3Int capitalPos, int playerId)
    {
        AddCapital(capitalPos, playerId);
        PlayerResources playerResources = new PlayerResources
        {
            Diamonds = 10000,
            Force    = 10000,
            Wood     = 10000
        };

        PlayersResources.Add(playerId, playerResources);
    }
Esempio n. 25
0
        public void Init()
        {
            DebugLog.DebugWrite($"INIT");
            var playerTransform = Locator.GetPlayerTransform();

            _playerResources   = playerTransform.GetComponent <PlayerResources>();
            _spaceSuit         = Locator.GetPlayerSuit();
            _playerSpawner     = FindObjectOfType <PlayerSpawner>();
            _suitPickupVolumes = FindObjectsOfType <SuitPickupVolume>();
            _fluidDetector     = Locator.GetPlayerCamera().GetComponentInChildren <FluidDetector>();
            _playerSpawnPoint  = GetSpawnPoint();
        }
Esempio n. 26
0
    private void DrawResourceIcon(PlayerResources type, int iconLeft, int textLeft, int topPos)
    {
        // Draws icon
        Texture2D icon = playerResourceIcons[type];

        GUI.DrawTexture(new Rect(iconLeft, topPos, ICON_WIDTH, ICON_HEIGHT), icon);

        // Draws value
        string text = playerResources[type].ToString();

        GUI.Label(new Rect(textLeft, topPos, TEXT_WIDTH, TEXT_HEIGHT), text);
    }
Esempio n. 27
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         PlayerResources.CollectItem(itemID, itemName, itemDescription);
         if (OnPickUpItemDestroyed != null)
         {
             OnPickUpItemDestroyed(gameObject.name);
         }
         Destroy(gameObject);
     }
 }
Esempio n. 28
0
        public void Tick(PlayerResources pr)
        {
            if (!Started)
            {
                var time = Queue.GetBuildTime(Item);
                if (time > 0)
                {
                    RemainingTime = TotalTime = time;
                }
                Started = true;
            }

            if (Done)
            {
                if (OnComplete != null)
                {
                    OnComplete();
                }
                return;
            }

            if (Paused)
            {
                return;
            }

            if (pm.PowerState != PowerState.Normal)
            {
                if (--slowdown <= 0)
                {
                    slowdown = Queue.Info.LowPowerSlowdown;
                }
                else
                {
                    return;
                }
            }

            var costThisFrame = RemainingCost / RemainingTime;

            if (costThisFrame != 0 && !pr.TakeCash(costThisFrame))
            {
                return;
            }
            RemainingCost -= costThisFrame;
            RemainingTime -= 1;
            if (RemainingTime > 0)
            {
                return;
            }

            Done = true;
        }
 // Definieren der Funktion OnMouseOver, welche die Funktion open() aufruft, wenn mit links(0) draufgeklickt wird
 void OnMouseOver()
 {
     availableMoney = GameObject.FindGameObjectWithTag("GameController").GetComponent <PlayerResources>();
     if (Input.GetMouseButtonDown(0))
     {
         availableMoney.money = availableMoney.money + 50;
     }
     else if (Input.GetMouseButtonDown(1))
     {
         availableMoney.money = availableMoney.money - 50;
     }
 }
Esempio n. 30
0
    void Update()
    {
        if (!UIHealthBar || !UIHealthBar.enabled)
        {
            print("Missing Health bar slider on " + gameObject.name); return;
        }
        if (!UIHealthText || !UIHealthText.enabled)
        {
            print("Missing Health bar text on " + gameObject.name); return;
        }


        if (!Player)
        {
            Player = GameObject.FindGameObjectWithTag("Player");
        }
        else if (!PR)
        {
            PR = Player.GetComponent <PlayerResources>();
        }
        else
        {
            if (UIHealthBar)
            {
                UIHealthBar.maxValue = PR.GetMaxHealth();
                UIHealthBar.value   += (PR.GetHealth() - UIHealthBar.value) * healthSegmentDrop;
                UIHealthBar.value    = Mathf.Clamp(UIHealthBar.value, 0, UIHealthBar.maxValue);

                if (UIHealthText)
                {
                    textHealthint     = (int)(UIHealthBar.value + 0.1f);
                    UIHealthText.text = textHealthint.ToString();
                }
            }
            if (expBar)
            {
                if (tmpExp != MasterObjectControl.masterObject.mocExperience)
                {
                    tmpExp = MasterObjectControl.masterObject.mocExperience;
                    int myExp = tmpExp;
                    while (myExp > (lvlScalar * lvl))
                    {
                        myExp -= (lvlScalar * lvl);
                        lvl++;
                    }
                    expBar.maxValue = lvlScalar * lvl;
                    expBar.value    = myExp % (lvlScalar * lvl - 1);
                    expBar.value    = Mathf.Clamp(expBar.value, 0, lvlScalar * lvl);
                }
            }
        }
    }
Esempio n. 31
0
 private void Awake()
 {
     s_cultureInfo = CultureInfo.CreateSpecificCulture("de-DE");;
     if (s_instance != null)
     {
         Debug.LogErrorFormat("There is already an instance of type {0}. Destroying this object.", GetType().Name);
         Destroy(gameObject);
     }
     else
     {
         s_instance = this;
     }
 }
Esempio n. 32
0
    //start off in a random direction
    //if you collide with the Room layer you bounce off
    //if you collide with the player you deal damage and bounce off

    void Start()
    {
        fly  = GameObject.FindGameObjectWithTag("FireFly").GetComponent <FireFlyResources>();
        pr   = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerResources>();
        anim = GetComponent <Animator>();
        rb   = GetComponent <Rigidbody2D>();
        br   = GetComponentInParent <BossResources>();
        startTimeBtwDamage = fly.rateOfFire;
        terra       = GetComponentInParent <SpawnOfTerra>();
        ps          = GetComponentsInChildren <ParticleSystem>();
        movement    = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f));
        rb.velocity = movement * 5;
    }
Esempio n. 33
0
	//player data load success callback
	private void OnLoadSuccess() {
		EventsAggregator.Network.RemoveListener(ENetworkEvent.PlayerDataLoadSuccess, OnLoadSuccess);

		//TODO: assign correct values
		Resources = new PlayerResources(10, 2500, 100);
		Inventory = new PlayerInventory();
		Heroes = new PlayerHeroes(new BaseHero[] { new BaseHero(UnitsConfig.Instance.GetHeroData(EUnitKey.Hero_Sniper), 0) }, 0);
		HeroSkills = new PlayerHeroSkills();
		City = new PlayerCity();
		StoryProgress = new PlayerStoryProgress();
		Statistics = new PlayerStatistics();
		VIPStatus = EPlayerVIP.None;
	}
Esempio n. 34
0
 // Use this for initialization
 void Start()
 {
     if (gameObject.name == "Enemy(Clone)") {
         maxHP = HP = 40;
         damage = 10;
     }
     else if (gameObject.name == "Enemy2(Clone)") {
         maxHP = HP = 60;
         damage = 15;
     }
     Player = GameObject.Find ("Player");
     ps = Player.GetComponent<PlayerStats> ();
     pr = Player.GetComponent<PlayerResources> ();
 }
Esempio n. 35
0
 public CavernaPlayer(int food, IServerSocket serverSocket)
 {
     _serverSocket = serverSocket;
     tilesManager = new CavernaPlayerTilesManager(this);
     animalManager = new AnimalManager();
     _playerResources = new PlayerResources();
     _newRoundBonuses = new List<List<string>>();
     //these will trigger a ui update, in case you started a new game
     Wood = 0;
     Ore = 0;
     Stone = 0;
     Veg = 0;
     Grain = 0;
     Food = food;
     Rubies = 0;
     Gold = 0;
     BeggingCards = 0;
     _dwarves.Add(new Dwarf(false, _dwarves.Count+1));
     _dwarves.Add(new Dwarf(false, _dwarves.Count+1));
     CalculatePlayerScore();
 }
Esempio n. 36
0
 // Use this for initialization
 void Start()
 {
     movement = player.GetComponent<PlayerMovementScript> ();
     resources = player.GetComponent<PlayerResources> ();
     NewApocalypse ();
     currentApocalypse.GetComponent<PolygonGenerator> ().player = this.player;
 }
Esempio n. 37
0
 void Awake()
 {
     _sr = GetComponent<SpriteRenderer>();
     _pr = FindObjectOfType<PlayerResources>();
     _costsText = GameObject.Find("UpgradeCosts").GetComponent<Text>();
 }
Esempio n. 38
0
 // Use this for initialization
 void Start()
 {
     Player = GameObject.Find ("Player");
     stats = Player.GetComponent<PlayerStats> ();
     resources = Player.GetComponent<PlayerResources>();
     isPaused = false;
 }
Esempio n. 39
0
 // Use this for initialization
 void Start()
 {
     Player = GameObject.Find ("Player");
     resources = Player.GetComponent<PlayerResources>();
 }
Esempio n. 40
0
 // Use this for initialization
 void Start()
 {
     Player = GameObject.Find ("Player");
     stats = Player.GetComponent<PlayerStats> ();
     resources = Player.GetComponent<PlayerResources>();
     isPaused = false;
     healthBarLength = Screen.width / 2;
 }
Esempio n. 41
0
 void Start()
 {
     _pr = FindObjectOfType<PlayerResources>();
 }
Esempio n. 42
0
 void Awake()
 {
     _pr = FindObjectOfType<PlayerResources>();
     _anim = GetComponent<Animator>();
 }
Esempio n. 43
0
    // Use this for initialization
    void Start()
    {
        //Change these once we set up persistant stat levels.
        precisionGuns = powerGuns = sharpWeapon = bluntWeapon
            = charm = intimidate = movement = medical = crafting
                = repairing = 20;
        if (PlayerPrefs.GetInt("Talent0") == 1) {
            precisionGuns += 10;
            powerGuns += 10;
            sharpWeapon += 10;
            bluntWeapon += 10;
        }
        pr = gameObject.GetComponent<PlayerResources> ();
        //Inv slots 3 -> 9 reserved for Mark.
        //Inv slots 10 -> 16 reserved for Kyle.
        inv = new float[17];
        currDam = 10;

        //fill the player's inventory with persistent items
        //Commenting this out for the moment, until we have the remnants of the
        //crafted items removed so as to not confuse the new inventory system.
        //This will likely return for if we have scene changes within one life.
        /*
        for (int i = 0; i<inv.Length; i++){
            inv [i] = PlayerPrefs.GetFloat("Inventory " + i.ToString());
        }*/
        currDef = 0;
    }
Esempio n. 44
0
    // Use this for initialization
    void Start()
    {
        pr = gameObject.GetComponent<PlayerResources> ();
        spriteRender = GetComponent<SpriteRenderer>();
        stats = GameObject.Find ("Player").GetComponent<PlayerStats> ();
        //		terrain = GameObject.Find ("Terrain").GetComponent<PolygonGenerator>();

        animator = GetComponent<Animator>(); //for sprite animation
        animator.SetTrigger ("snot");
        lastDir = 2;
        knockBackTimer = 11;
        colorChangeTimer = 0;
        yellowTimer = 0;
        blueTimer = 0;
        isRed = false;
        isYellow = false;
        isGreen = false;
        isBlue = false;
    }