protected override void OnRabitHit(RabbitController rabit) { animateController = rabit.gameObject.GetComponent <AnimateController>(); RabbitStats stats = rabit.gameObject.GetComponent <RabbitStats>(); if (stats.isDead) { return; } if (rabit.isVulnerable) { CollectedHide(); if (stats.rabbitSize == 0) { stats.isDead = true; die(); } else { stats.rabbitSize = 0; makeRabbitSmaller(rabit); rabit.isVulnerable = false; rabit.gameObject.GetComponent <FlashObject>().startBlinking(); } } }
void OnTriggerEnter2D(Collider2D collider) { //Намагаємося отримати компонент кролика RabbitController rabit = collider.GetComponent <RabbitController>(); //Впасти міг не тільки кролик if (rabit == null) { return; } animateController = rabit.gameObject.GetComponent <AnimateController>(); RabbitStats stats = rabit.gameObject.GetComponent <RabbitStats>(); if (rabit.isVulnerable) { if (stats.rabbitSize == 0) { die(); } else { stats.rabbitSize = 0; makeRabbitSmaller(rabit); rabit.isVulnerable = false; rabit.gameObject.GetComponent <FlashObject>().startBlinking(); } } }
private void initEverythingBeforehand() { rabbitStats = LevelController.getRabbit().GetComponent <RabbitStats>(); animateController = LevelController.getRabbit().GetComponent <AnimateController>(); rabbitController = LevelController.getRabbit().GetComponent <RabbitController>(); base.attacking = false; base.running = false; }
// Start is called before the first frame update void Start() { monsterNames = new List <string>(); attractedMonsters = new List <MonsterController>(); flameRenderer = GetComponent <SpriteRenderer>(); flameAniController = GetComponent <AnimateController>(); flameAnimator = GetComponent <Animator>(); transform.localScale = GameManager.Instance.gridScale; }
void Start() { sound = GameObject.Find("SoundObjects").GetComponent <SoundController>(); golightRenderer = golight.GetComponent <Renderer>() as SpriteRenderer; golightAniController = golight.GetComponent <AnimateController>(); // check launcher object exists GameObject launcherObj = GameObject.Find("Plunger-springjoint"); if (launcherObj != null) { launcherScript = launcherObj.GetComponent <Launcher>(); } }
void Start() { // animation object thisRenderer = curveLampLightObj.GetComponent <Renderer>() as SpriteRenderer; aniController = curveLampLightObj.GetComponent <AnimateController>(); // get scoreboard object GameObject obj = GameObject.Find("scoreText"); if (obj != null) { scoreBoard = obj.GetComponent <ScoreBoard>(); } }
void Start() { // Get scoreboard and sound object GameObject obj = GameObject.Find("scoreText"); scoreBoard = obj.GetComponent <ScoreBoard>(); sound = GameObject.Find("SoundObjects").GetComponent <SoundController>(); // Animation objects handcamRenderer = handcamObj.GetComponent <Renderer>() as SpriteRenderer; golightRenderer = golightObj.GetComponent <Renderer>() as SpriteRenderer; handcamAniController = handcamObj.GetComponent <AnimateController>(); golightAniController = golightObj.GetComponent <AnimateController>(); effect = GetComponent <BuoyancyEffector2D>(); }
void Start() { // zoom animation object efxZoomAniController = efxZoomObj.GetComponent <AnimateController>(); efxLightAniController = efxLightObj.GetComponent <AnimateController>(); // zoom light object efxZoomRenderer = efxZoomObj.GetComponent <Renderer>() as SpriteRenderer; efxLightRenderer = efxLightObj.GetComponent <Renderer>() as SpriteRenderer; // sounds sounds = GameObject.Find("SoundObjects").GetComponent <SoundController>(); pullSound = sounds.pulldown; shootSound = sounds.zonar; springJoint = GetComponent <SpringJoint2D>(); springJoint.distance = 1f; }
// Use this for initialization void Start() { shouldPlayFallSound = false; isVulnerable = true; invulnerabilityTime = 4f; _invulnerabilityTime = invulnerabilityTime; myBody = this.GetComponent <Rigidbody2D>(); animateController = this.GetComponent <AnimateController>(); spriteRenderer = this.GetComponent <SpriteRenderer>(); LevelController.current.setStartPosition(transform.position); this.parent = this.transform.parent; Physics2D.IgnoreLayerCollision(12, 10, true); }
// Use this for initialization void Start() { animateController = GetComponent <AnimateController>(); thisRenderer = GetComponent <Renderer>() as SpriteRenderer; sound = GetComponent <AudioSource>(); }