private void Start() { isDrop = false; health = 70; currentHealth = health; timeBetweenShots = 1.2f; target = GameObject.FindGameObjectWithTag("Player").transform; probability = gameObject.GetComponent <DropProbability>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); anim = GetComponent <Animator>(); rb = gameObject.GetComponent <Rigidbody>(); isStunned = false; myRenderer = GetComponent <SpriteRenderer>(); color = myRenderer.color; shakeTime = 0.3f; shouldInstParticle = false; hasInstParticle = false; healTimer = 10f; }
// Use this for initialization void Start() { health = 10; currentHealth = 10; if (sceneName == "2_1" || sceneName == "2_2" || sceneName == "3_1" || sceneName == "3_2") { healthBar.GetComponent <Image>().fillOrigin = (int)Image.OriginHorizontal.Left; } probability = gameObject.GetComponent <DropProbability>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); sceneName = SceneManager.GetActiveScene().name; }
// 一個選ぶテスト private void DetermineFromDict() { if (_rand == 0) { Dictionary <GameObject, int> targetDicts = new Dictionary <GameObject, int>() { { _memory, 20 }, { _dryCell, 15 }, { _screw, 30 }, { _semiconductor, 85 }, { _ironPlate, 95 }, { _battery, 80 } }; _dropObj = DropProbability.DetermineFromDict <GameObject>(targetDicts); Debug.Log(_dropObj); } else if (_rand == 1) { Dictionary <GameObject, int> targetDicts = new Dictionary <GameObject, int>() { { _memory, 60 }, { _dryCell, 20 }, { _screw, 50 }, { _semiconductor, 15 }, { _ironPlate, 5 }, { _battery, 20 } }; _dropObj = DropProbability.DetermineFromDict <GameObject>(targetDicts); Debug.Log(_dropObj); } else if (_rand == 2) { Dictionary <GameObject, int> targetDicts = new Dictionary <GameObject, int>() { { _memory, 20 }, { _dryCell, 60 }, { _screw, 20 }, { _semiconductor, 0 }, { _ironPlate, 0 }, { _battery, 0 } }; _dropObj = DropProbability.DetermineFromDict <GameObject>(targetDicts); Debug.Log(_dropObj); } else if (_rand == 3) { Dictionary <GameObject, int> targetDicts = new Dictionary <GameObject, int>() { { _memory, 0 }, { _dryCell, 5 }, { _screw, 0 }, { _semiconductor, 0 }, { _ironPlate, 0 }, { _battery, 0 } }; _dropObj = DropProbability.DetermineFromDict <GameObject>(targetDicts); Debug.Log(_dropObj); } }
void Start() { isDrop = false; health = 90; currentHealth = health; waitTime = 0f; canJump = true; startPos = transform.position; player = GameObject.FindGameObjectWithTag("Player").transform; probability = gameObject.GetComponent <DropProbability>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); anim = GetComponent <Animator>(); hasInstantiatedLanding = false; hasInstantiatedImpact = false; rb = GetComponent <Rigidbody>(); isStunned = false; hasReached = false; hasCollidedWithObjects = false; cc = GetComponent <CapsuleCollider>(); shakeTime = 0.3f; shouldShake = false; hasShaken = false; shouldMakeSound = true; hasMadeSound = false; shouldInstParticle = false; hasInstParticle = false; healTimer = 10f; }
void Start() { //Set player as the target health = 51; currentHealth = health; player2 = GetComponent <Player_New>(); rb = gameObject.GetComponent <Rigidbody>(); isStunned = false; damage = 5; target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); probability = gameObject.GetComponent <DropProbability>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); anim = GetComponent <Animator>(); myRenderer = GetComponent <SpriteRenderer>(); defaultColor = myRenderer.material.color; patrolTime = 1.5f; canPatrol = true; isChasing = false; collidedWithObstacle = false; chaseAgainTime = 1.25f; moveSpot = new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), 0); reachedPatrolPoint = false; shouldInstParticle = false; hasInstParticle = false; healTimer = 10f; // soundmanager = GetComponent<SoundManager>(); }
// public AnimationClip death; void Start() { isDrop = false; scene = SceneManager.GetActiveScene(); capsule = gameObject.GetComponent <CapsuleCollider>(); if (scene.name == "2_1" || scene.name == "2_2" || scene.name == "3_1" || scene.name == "3_2") { transform.localScale = new Vector3(6f, 6f, 1f); dashSpeed = 100f; rangeForAttack = 100f; capsule.radius = 1.84f; capsule.height = 5.51f; rangeForAttack = 120f; reachedDistance = 3f; slide.transform.localScale = new Vector3(14f, 14f, 1f); peffect.transform.localScale = new Vector3(2.6f, 2.6f, 2.6f); } else if (scene.name == "First Level") { transform.localScale = new Vector3(0.3f, 0.3f, 1f); dashSpeed = 6.5f; rangeForAttack = 7f; capsule.radius = 0.55f; capsule.height = 5.51f; reachedDistance = 0.1f; slide.transform.localScale = new Vector3(0.7f, 0.7f, 1f); peffect.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f); } rb = GetComponent <Rigidbody>(); canDash = true; dashTime = 1.6f; damage = 7; health = 130; currentHealth = health; player = GetComponent <Player_New>(); target = GameObject.FindGameObjectWithTag("Player").transform; anim = GetComponent <Animator>(); hasCollided = false; hasReached = false; probability = gameObject.GetComponent <DropProbability>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); isStunned = false; shouldDestroyDash = false; hasCollidedWithOthers = false; cc = GetComponent <CapsuleCollider>(); shakeTime = 0.25f; producePeffect = false; soundmanager = GetComponent <SoundManager>(); shouldInstParticle = false; hasInstParticle = false; healTimer = 10f; }