// Attack animation variation //[SerializeField] //private int numAttackAnims = 1; void Start() { sfxc = GetComponent <SFXController>(); dropper = GetComponent <LootDropper>(); healthBar.SetMaxHealth(maxHealth); currHealth = maxHealth; }
// Start is called before the first frame update void Start() { hurtable = GetComponent <Hurtable>(); hurtable.Initialize(config.HealthConfig); lootDropper = GetComponent <LootDropper>(); lootDropper.Initialize(config.LootConfig); rigidBody = GetComponent <Rigidbody2D>(); renderer = GetComponentInChildren <SpriteRenderer>(); anim = GetComponent <Animator>(); Retarget(); playerLayer = LayerMask.NameToLayer("Player"); player = GameObject.FindGameObjectWithTag("Player").transform; if (config.IsJelly) { rigidBody.gravityScale = 0.1f; direction = Vector2.up; } Swim(); spriteRenderers = new List <SpriteRenderer>(GetComponentsInChildren <SpriteRenderer>()); spriteRenderers.AddRange(GetComponents <SpriteRenderer>()); origColors = spriteRenderers.Select(rend => rend.color).ToList(); startPosition = transform.position; }
// Start is called before the first frame update void Start() { lootDropper = GetComponent <LootDropper>(); lootDropper.Initialize(chestConfig.LootConfig); GetComponent <Hurtable>().Initialize(chestConfig.HealthConfig); }
public override void OnInspectorGUI() { DrawDefaultInspector(); if (!EditorApplication.isPlaying) { return; } LootDropper myScript = (LootDropper)target; _amount = EditorGUILayout.IntField("Amount", _amount); if (GUILayout.Button("Drop")) { myScript.Drop(_amount); Debug.Log("Dropped " + _amount); } var totalChance = myScript.ItemDefinitions.Sum(x => x.Chance).ToString(); EditorGUILayout.LabelField("Total Weight: ", totalChance); if (GUILayout.Button("Random Item")) { var item = myScript.GetRandomItem(); Debug.Log("Random Item:"); Debug.Log(JsonUtility.ToJson(item)); } }
private void DestroySelf() { LootDropper dropper = GetComponent <LootDropper>(); if (dropper != null) { dropper.Drop(); } Destroy(this.gameObject); }
public void landOnPlanet(PlanetType planetType) { gamePaused = true; shieldsPool.clearPool(); Vars.enemyShipsPool.Clear(); UserInterface.showInterface = false; statusScreen.sendToVars(); Vars.planetType = planetType; ExplosionsManager.clear(); LootDropper.clearContainers(); SceneManager.LoadScene("PlanetSurface"); }
private void init() { Vars.initVars(); Vars.inSpace = true; ItemFactory.itemPrefab = itemPrefab; mainCamera = Camera.main.transform; Imager.initialize(); Player.init(); GameObject.Find("Images Provider").GetComponent <ImagesProvider>().init(); starField = GameObject.Find("StarField").GetComponent <StarField>().init(); star = transform.Find("Star").GetComponent <SpriteRenderer>(); star.gameObject.SetActive(true); ItemDescriptor descriptor = GameObject.Find("Item Descriptor").GetComponent <ItemDescriptor>().init(); statusScreen = GameObject.Find("Status Screen").GetComponent <StatusScreen>().init(this, descriptor); descriptor.playerData = statusScreen.playerData; if (Vars.shipCurrentHealth == -1) { statusScreen.shipData.initializeRandomShip(HullType.ARMAGEDDON); statusScreen.inventory.setCapacity(statusScreen.shipData.hullType.getStorageCapacity()); } else { statusScreen.initFromVars(); } initPlayerShip(); statusScreen.cameraController = cameraController; Vars.userInterface = GameObject.FindGameObjectWithTag("UserInterface").GetComponent <UserInterface>().init(statusScreen, this, playerShip); shieldsPool = GameObject.Find("ShieldsPool").GetComponent <ShieldsPool>(); explosionsManager = GameObject.Find("Explosions Manager").GetComponent <ExplosionsManager>().init(); lootDropper = GameObject.Find("Loot Dropper").GetComponent <LootDropper>().init(statusScreen.inventory, descriptor); spawner = GetComponent <EnemySpawner>().init(Vars.userInterface.minimap, playerShip.transform); loadStarSystem(); gamePaused = false; }
// Start is called before the first frame update void Start() { hurtable = GetComponent <Hurtable>(); hurtable.Initialize(config.HealthConfig); lootDropper = GetComponent <LootDropper>(); lootDropper.Initialize(config.LootConfig); rigidBody = GetComponent <Rigidbody2D>(); renderer = GetComponentInChildren <SpriteRenderer>(); anim = GetComponent <Animator>(); Retarget(); playerLayer = LayerMask.NameToLayer("Player"); player = GameObject.FindGameObjectWithTag("Player").transform; }
virtual public void destroyShip(bool dropLoot) { gameObject.SetActive(false); destroed = true; LootDropper.drop(this); }