Example #1
0
        // Start is called before the first frame update
        void Start()
        {
            m_Animator = GetComponentInChildren <Animator>();
            m_Agent    = GetComponent <NavMeshAgent>();

            m_SpeedAnimHash  = Animator.StringToHash("Speed");
            m_AttackAnimHash = Animator.StringToHash("Attack");
            m_DeathAnimHash  = Animator.StringToHash("Death");
            m_HitAnimHash    = Animator.StringToHash("Hit");

            m_CharacterData = GetComponent <CharacterData>();
            m_CharacterData.Init();

            m_CharacterAudio = GetComponentInChildren <CharacterAudio>();

            m_CharacterData.OnDamage += () =>
            {
                m_Animator.SetTrigger(m_HitAnimHash);
                m_CharacterAudio.Hit(transform.position);
            };

            m_Agent.speed    = Speed;
            m_LootSpawner    = GetComponent <LootSpawner>();
            m_StartingAnchor = transform.position;
        }
    void Start()
    {
        player      = GameObject.FindGameObjectWithTag("Player");
        lootSpawner = GameObject.FindGameObjectWithTag("GameManager").GetComponent <LootSpawner>();

        SetupAnimator();
    }
    void Start()
    {
        Monetization.Initialize("2943700", true);
        this.rzabkaGiver = GameObject.Find("RzabaSpawner").GetComponent <RzabaSpawner>();
        ZaboPodmieniarka(rzabkaGiver.ProszemDacRzabke(new Vector3(0, 0, 0)));
        this.flowerManager = new FlowerManager();
        this.lootSpawner   = GameObject.Find("LootSpawner").GetComponent <LootSpawner>();
        this.happyFrogs    = new List <GameObject>();
        this.currentFrog   = GameObject.Find("Frog");
        this.modifiers     = new List <FlowerModifier>();
        Screen.orientation = ScreenOrientation.Portrait;
        this.wybuch        = GameObject.Find("Wybuch").transform.Find("Explosion");
        this.wybuch.gameObject.SetActive(false);
        this.dymek = GameObject.Find("Dymek").transform.Find("Smoke");
        this.dymek.gameObject.SetActive(false);
        this.goToCollectionButton = GameObject.Find("GoToCollectionButton");
        this.trzepacz             = GameObject.Find("TrzepaczHajsu").GetComponent <TrzepaczHajsu>();

        this.trzepacz.rewarder = delegate(bool p)
        {
            modifiers.Add(new FlowerModifier(2, 60, p));
        };
        this.playerResourcesScript = GameObject.Find("PlayerResources").GetComponent <PlayerResourcesScript>();
        LoadData();


        GameObject.Find("Shop").GetComponent <ShopScript>().itemDatas.FindAll(x => x.isBought).ForEach(x => {
            modifiers.Add(new FlowerModifier(2, 60, true));
        });
    }
Example #4
0
        // Start is called before the first frame update
        void Start()
        {
            m_CharacterData = GetComponent <CharacterData>();
            m_CharacterData.Init();

            m_LootSpawner = GetComponent <LootSpawner>();
        }
Example #5
0
    // Token: 0x060006E2 RID: 1762 RVA: 0x00038BC8 File Offset: 0x00036DC8
    private void UpdateSpawner()
    {
        if (!this.m_nview.IsOwner())
        {
            return;
        }
        if (!this.m_spawnAtDay && EnvMan.instance.IsDay())
        {
            return;
        }
        if (!this.m_spawnAtNight && EnvMan.instance.IsNight())
        {
            return;
        }
        if (this.m_spawnWhenEnemiesCleared)
        {
            bool flag = LootSpawner.IsMonsterInRange(base.transform.position, this.m_enemiesCheckRange);
            if (flag && !this.m_seenEnemies)
            {
                this.m_seenEnemies = true;
            }
            if (flag || !this.m_seenEnemies)
            {
                return;
            }
        }
        long     @long    = this.m_nview.GetZDO().GetLong("spawn_time", 0L);
        DateTime time     = ZNet.instance.GetTime();
        DateTime d        = new DateTime(@long);
        TimeSpan timeSpan = time - d;

        if (this.m_respawnTimeMinuts <= 0f && @long != 0L)
        {
            return;
        }
        if (timeSpan.TotalMinutes < (double)this.m_respawnTimeMinuts)
        {
            return;
        }
        if (!Player.IsPlayerInRange(base.transform.position, 20f))
        {
            return;
        }
        List <GameObject> dropList = this.m_items.GetDropList();

        for (int i = 0; i < dropList.Count; i++)
        {
            Vector2    vector   = UnityEngine.Random.insideUnitCircle * 0.3f;
            Vector3    position = base.transform.position + new Vector3(vector.x, 0.3f * (float)i, vector.y);
            Quaternion rotation = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f);
            UnityEngine.Object.Instantiate <GameObject>(dropList[i], position, rotation);
        }
        this.m_spawnEffect.Create(base.transform.position, Quaternion.identity, null, 1f);
        this.m_nview.GetZDO().Set("spawn_time", ZNet.instance.GetTime().Ticks);
        this.m_seenEnemies = false;
    }
Example #6
0
 public int[] dropAmount;                   //how much loot to drop
 public void Drop()                         //drop loot
 {
     for (int i = 0; i < drops.Length; i++) //loop for all possible drop chances
     {
         if (Random.Range(1, 101) <= dropRates[i])
         {
             LootSpawner.SpawnLoot(drops[i], dropAmount[i], transform);                                       //spawn the loot if RNJ says so
         }
     }
 }
Example #7
0
        protected override void Eval(NodeChain nodeChain)
        {
            var itemId = (string)ValueOf("Item");
            var item   = Rm_RPGHandler.Instance.Repositories.CraftableItems.Get(itemId);

            if (item != null)
            {
                var spawnPos = (RPGVector3)ValueOf("Position");
                LootSpawner.SpawnWorldLootItem(spawnPos, 1, item);
            }
        }
Example #8
0
    Loot thisLoot;                                              //instance of the loot that this game object is

    public void DefineMe()                                      //set up game objects apperance and instanciates the loot
    {
        thisLoot = LootSpawner.GetLootFromNum(lootNum, amount); //instanciates the loot and save it
        Mesh mesh = Resources.Load <GameObject>(thisLoot.meshPath).GetComponent <MeshFilter>().sharedMesh;

        GetComponent <MeshFilter>().sharedMesh       = mesh;
        GetComponent <MeshCollider>().sharedMesh     = mesh;
        GetComponent <MeshRenderer>().sharedMaterial = Resources.Load <GameObject>(thisLoot.meshPath).GetComponent <MeshRenderer>().sharedMaterial;
        GetComponent <Rigidbody>().mass = thisLoot.weight;
        name = thisLoot.name + "(loot instance)";
    }
    void SpawnRandomLoot(LootSpawner spawner)
    {
        List <Item> allItems = DatabaseControl.GetAllItems();
        int         randNumb = Random.Range(MinItems, MaxItems);
        List <Item> randItem = new List <Item>();

        for (int i = 0; i < randNumb; i++)
        {
            randItem.Add(allItems[Random.RandomRange(0, allItems.Count - 1)]);
        }
        spawner.SpawnLoot(randItem);
    }
Example #10
0
 public void Drop(int lootNum, int amount, bool swapItem, int index, Transform dropPos) //moves an item from inventory to game world, needs loot num to identify it, swap bool to know if it's in loot or swapLoot slot, needs index if it's not and a transform to know where to drop it
 {
     LootSpawner.SpawnLoot(lootNum, amount, dropPos);                                   //spawns the loot
     if (swapItem)
     {
         swapLoot = AllLoot.Empty();           //remove it from swapLoot slot
     }
     if (!swapItem)
     {
         Remove(loots[index]);            //currently unused, but the idea is the you can drop it directly from you inventory with a keyboard shortcut, remove it from inventory
     }
 }
Example #11
0
 public static void ClearReferences()
 {
     _playerMonoGo          = null;
     _playerMono            = null;
     _playerCharacter       = null;
     _rpgCamera             = null;
     _playerSave            = null;
     _sceneMasterGameObject = null;
     _lootSpawner           = null;
     _audioPlayer           = null;
     _playerController      = null;
     _eventHandler          = null;
     _uiHandler             = null;
     _rpgMinimapCamera      = null;
 }
    /// <summary>
    /// Doing this comment for assembly temp
    /// </summary>
    private void Awake()
    {
        lootSpawner  = GetComponent <LootSpawner>();
        m_Animator   = GetComponent <Animator>();
        m_Agent      = GetComponent <NavMeshAgent>();
        m_AgentSpeed = m_Agent.speed;
        m_Index      = Random.Range(0, WayPoints.Length);

        InvokeRepeating("Tick", 0, 0.5f);
        if (WayPoints.Length > 0)
        {
            InvokeRepeating("Patrol", Random.Range(0, PatrolTime), PatrolTime);
        }

        m_TimeOfLastAttack = float.MinValue;

        CanAttack = false;
        m_Animator.SetBool("Dead", false);
    }
Example #13
0
    public static Ship SpawnNPC(ShipSpawnInfo spawnInfo, Vector3 pos)
    {
        var ship = SpawnShip(spawnInfo, pos);
        var ai   = ship.GetComponent <StateController>();

        if (ai == null)
        {
            Debug.LogWarning("Spawning NPC without AI Controller...");
        }
        else
        {
            ai.currentState = spawnInfo.state;
            ai.Target       = spawnInfo.target;
            ai.aiIsActive   = true;
        }

        ship.Died += (s) => { LootSpawner.SpawnLoot(s.transform.position, spawnInfo); };

        return(ship);
    }
 private static void SetLink(LootSpawner __instance)
 {
     CreateLink(__instance.m_items, __instance.gameObject);
 }
 // Start is called before the first frame update
 void Start()
 {
     LootSpawner.SpawnLoot(1, 1, transform);
 }
 public void AddLootSpawner(LootSpawner spawner)
 {
     LootSpawners.Add(spawner);
 }
Example #17
0
 // Token: 0x06000EAB RID: 3755 RVA: 0x000690E1 File Offset: 0x000672E1
 private bool EnemyNearby(Vector3 point)
 {
     return(LootSpawner.IsMonsterInRange(point, this.m_enemyCheckDistance));
 }
Example #18
0
 protected virtual void Awake()
 {
     lootSpawner = GetComponent <LootSpawner>();
 }
Example #19
0
 public void SetAmount(int value, LootSpawner spawner)
 {
     amount = value;
 }
 private void Start()
 {
     m_LootSpawner = GetComponent <LootSpawner>();
 }