private void Awake() { _camera = GameObject.FindWithTag("Plan Camera").GetComponent <Camera>(); trap = prefab.GetComponent <TrapBase>(); indicator = GetComponent <RangeIndicator>(); counter.count = initialCount; }
private void Start() { tb = GetComponentInParent <TrapBase>(); toCheck = tb.ValidLocations; Valid = false; }
private void SetTrap() { if (ghostTrap != null) { //Check if trap is on correct surface bool validLocation; CheckMultipleBases bases = ghostTrap.GetComponentInChildren <CheckMultipleBases>(); CheckValidLocations check = ghostTrap.GetComponentInChildren <CheckValidLocations>(); if (bases != null) { validLocation = bases.Valid; } else if (check != null) { validLocation = check.Valid; } else { validLocation = true; Debug.Log("Warning: Trap not set up correctly; valid location is always true."); } //CheckNearby() also checks the collider provided for the "safe zone" around the trap if (GetGridPosition() != null && CheckNearby() && validLocation) { Vector3 position = GetGridPosition().Value; if (ghostTrap != null && CheckFloor(position.y)) { audioSource.PlayOneShot(trapPlacementGood); trap.InstantiateTrap(position, ghostTrap.transform.rotation); if (check != null) { check.Placed = true; } //if (bases != null) bases.Placed = true; ClearButton(); trap = null; foreach (SpriteRenderer sr in placementSquares) { sr.enabled = false; } placementSquares = null; DestroyGhost(); SetSelectedButton(); } else { audioSource.PlayOneShot(trapPlacementBad); } } else { audioSource.PlayOneShot(trapPlacementBad); } } }
// Use this for initialization void Start() { trapBase = GetComponent <TrapBase>(); Destroy(gameObject, 5.0f); child = this.GetComponentsInChildren <Renderer>(); hit = false; audioSource = GetComponent <AudioSource>(); audioSource.PlayOneShot(releaseSFX); }
//Called from trap button / CallClick script public void OnClickTrap(int trapNum) { trap = trapPrefabs[trapNum]; trapRot = 0; // eventSystem.SetSelectedGameObject(null); StartCoroutine(EnableInput()); DestroyGhost(); GetComponent <CastSpell>().DestroyTarget(); SetGhost(); }
// Use this for initialization void Start() { audioSource = GetComponent <AudioSource>(); trapBase = GetComponent <TrapBase>(); meshRenderers = GetComponentsInChildren <SkinnedMeshRenderer>(); key = meshRenderers[0].GetBlendShapeWeight(0); InvokeRepeating("Scale", 0f, 0.001f); }
private void Start() { trapBase = GetComponent <TrapBase>(); audioSource = GetComponent <AudioSource>(); thisAnim = GetComponentInChildren <Animator>(); }
//EffectPool effectPool = GameManager.Instance.pools.effectPool; public void run_coroutine(List <AnimObject> sub_animObjects) { while (sub_animObjects.Count > 0) { AnimObject animObject = sub_animObjects[0]; if (animObject.objectBase.ObjectBody == null) { switch (animObject.objectBase.objectBase_type) { case ObjectBaseType.BLOCK: BlockBase blockBase = ((BlockBase)animObject.objectBase); GameManager.Instance.pools.objectBodyPool.get_body(blockBase.blockType, blockBase.node_now.position); break; case ObjectBaseType.CHARACTER: PlayerBase playerBase = ((PlayerBase)animObject.objectBase); GameManager.Instance.pools.objectBodyPool.get_body(playerBase.monsterType, playerBase.node_now.position); break; case ObjectBaseType.DOOR: DoorBase doorBase = ((DoorBase)animObject.objectBase); GameManager.Instance.pools.objectBodyPool.get_body(doorBase.doorType, doorBase.node_now.position, animObject.UDLR); break; case ObjectBaseType.ITEM: ItemBase itemBase = ((ItemBase)animObject.objectBase); GameManager.Instance.pools.objectBodyPool.get_body(itemBase.itemType, itemBase.node_now.position); break; case ObjectBaseType.MONSTER: MonsterBase monsterBase = ((MonsterBase)animObject.objectBase); GameManager.Instance.pools.objectBodyPool.get_body(monsterBase.monsterType, monsterBase.node_now.position); break; case ObjectBaseType.TRAP: TrapBase trapBase = ((TrapBase)animObject.objectBase); GameManager.Instance.pools.objectBodyPool.get_body(trapBase.trapType, trapBase.node_now.position); break; } } else { animObject.objectBase.ObjectBody.SetActive(true); } if (animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow != null) { StopCoroutine(animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow); GameManager.Instance.sub_managers.animManager.running_list--; animObject.objectBase.ObjectBody.GetComponentInChildren <Animator>().SetInteger("MoveType", (int)AnimType.IDLE); recall(animObject); animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = null; } switch (animObject.animType) { case AnimType.ATTACK: animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(attack(animObject, sub_animObjects)); break; case AnimType.CANNOTATTACK: animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(cannot_attack(animObject, sub_animObjects)); break; case AnimType.HIT: animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(hit(animObject, sub_animObjects)); break; case AnimType.DEATH: animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(death(animObject, sub_animObjects)); break; case AnimType.DEATHWITHOUTDELAY: animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(death_withoutdelay(animObject, sub_animObjects)); break; case AnimType.MOVE: //animObject.objectBase.ObjectBody.GetComponentInChildren<Animator>().SetInteger("MoveType", (int)AnimType.LANDING); animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(move(animObject, sub_animObjects)); break; case AnimType.FASTMOVE: animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(fast_move(animObject, sub_animObjects)); break; case AnimType.TRY: //StartCoroutine(try_something(animObject, sub_animObjects)); break; case AnimType.LANDING: animObject.objectBase.ObjectBody.GetComponentInChildren <Animator>().SetInteger("MoveType", (int)AnimType.LANDING); recall(animObject); break; case AnimType.HIGHLIGHT: if (!highlightlist.Contains(animObject.objectBase.ObjectBody)) { highlightlist.Add(animObject.objectBase.ObjectBody); } break; case AnimType.HIT_WITHBLOOD: animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(hit_withblood(animObject, sub_animObjects)); break; case AnimType.HIT_WITHOUTBLOOD: animObject.objectBase.ObjectBody.GetComponent <CoroutineBox>().coroutineNow = StartCoroutine(hit_withoutblood(animObject, sub_animObjects)); break; case AnimType.ITEMEFFECT: StartCoroutine(itemeffect(animObject)); break; } sub_animObjects.RemoveAt(0); } if (!highlightisRunning && highlightlist.Count > 0) { StartCoroutine(highlight(sub_animObjects)); } }
public void SetUpTrap(TrapBase theType) { theTrapType = theType; GetComponent <MeshFilter>().sharedMesh = theType.theMesh; gameObject.GetComponent <Renderer>().sharedMaterial = theType.theMaterial; }
private void Start() { trapBase = GetComponent <TrapBase>(); }
public TrapActivateEvent(TrapBase trap, GameObject activated) { this.trap = trap; this.activated = activated; }
//private bool ghost = true; // Use this for initialization void Start() { prefab = Resources.Load("projectile") as GameObject; trapBase = GetComponent <TrapBase>(); cam = GameObject.Find("Player 2 Camera").GetComponent <CameraTwoRotator>(); animator = GetComponentInChildren <Animator>(); if (!GetComponentInChildren <CheckMultipleBases>().Placed) { switch (cam.GetState()) { case 1: transform.eulerAngles = new Vector3(0, 0, 0); projectileRotation = Quaternion.identity; velocity = new Vector3(-20, 0, 0); break; case 2: transform.eulerAngles = new Vector3(0, 270, 0); projectileRotation = Quaternion.Euler(0, -90, 0); velocity = new Vector3(0, 0, -20); break; case 3: transform.eulerAngles = new Vector3(0, 180, 0); projectileRotation = Quaternion.Euler(0, -180, 0); velocity = new Vector3(20, 0, 0); break; case 4: transform.eulerAngles = new Vector3(0, 90, 0); projectileRotation = Quaternion.Euler(0, -270, 0); velocity = new Vector3(0, 0, 20); break; } } else { switch (FaceNumberIfPrePlaced) { case 1: transform.eulerAngles = new Vector3(0, 0, 0); projectileRotation = Quaternion.identity; velocity = new Vector3(-20, 0, 0); break; case 2: transform.eulerAngles = new Vector3(0, 270, 0); projectileRotation = Quaternion.Euler(0, -90, 0); velocity = new Vector3(0, 0, -20); break; case 3: transform.eulerAngles = new Vector3(0, 180, 0); projectileRotation = Quaternion.Euler(0, -180, 0); velocity = new Vector3(20, 0, 0); break; case 4: transform.eulerAngles = new Vector3(0, 90, 0); projectileRotation = Quaternion.Euler(0, -270, 0); velocity = new Vector3(0, 0, 20); break; } } }