// Use this for initialization void Start() { // cache references platformPrefab = Resources.Load("Prefabs/Platform"); playerPlatformPrefab = Resources.Load("Prefabs/PlayerPlatform"); gravityCenterPrefab = Resources.Load("Prefabs/GravityCenter"); targetingReticlePrefab = Resources.Load("Prefabs/Reticle"); // set up sounds jumpSource = GetComponents <AudioSource>()[0]; takeDamageSource = GetComponents <AudioSource>()[1]; // get distance to ground distToGround = collider.bounds.extents.y; frontRotation = Quaternion.Euler(0, 180, 0); leftRotation = Quaternion.Euler(0, -90, 0); rightRotation = Quaternion.Euler(0, 90, 0); currentGun = GunType.PlatformGun; invincibilityFrames = 0; numFrameFloating = -1; platformChanged = false; // do not allow collisions between reticle and certain objects that should be not be selectable for gravity center effects Physics.IgnoreLayerCollision(8, 9, true); // instantiate recticle Vector3 reticlePosition = new Vector3(transform.position.x + 4f, transform.position.y + 3, transform.position.z); targetingReticle = (GameObject)Instantiate(targetingReticlePrefab, reticlePosition, Quaternion.Euler(90, 0, 0)); reticleScript = targetingReticle.GetComponent <ReticleScript>(); }
//Check for input if player is deselecint a character void CheckForDeselect(int index) { selectReticles[index].SetActive(true); ReticleScript rs = selectReticles[index].GetComponent <ReticleScript>(); int character = rs.GetCharExamine(); charAvailable[character - 1] = true; rs.CharacterDeselected(); selected[index] = 0; charactersSelected--; //Play Deselect sound }
private new void Awake() { base.Awake(); PlayerAnim = GetComponent <Animator>(); playCon = GetComponent <PlayerController>(); if (playCon) { reticle = playCon.reticle; } viewCamera = Camera.main; }
public void AddEntityInfo(Entity entity, ReticleScript reticle) { var secondary = Instantiate(secondaryTargetInfoPrefab, content); secondary.GetComponent <Button>().onClick.AddListener(new UnityEngine.Events.UnityAction (() => { if (Input.GetKey(KeyCode.LeftShift)) { reticle.RemoveSecondaryTarget(entity); } else { var targSys = PlayerCore.Instance.GetTargetingSystem(); if (targSys.GetTarget() && targSys.GetTarget().GetComponent <Entity>()) { reticle.AddSecondaryTarget(targSys.GetTarget().GetComponent <Entity>()); } reticle.SetTarget(entity.transform); reticle.RemoveSecondaryTarget(entity); } })); if (!secondaryInfosByEntity.ContainsKey(entity)) { secondaryInfosByEntity.Add(entity, secondary); } else { if (secondaryInfosByEntity[entity]) { Destroy(secondaryInfosByEntity[entity].gameObject); } secondaryInfosByEntity[entity] = secondary; } }
public void Initialize(WeaponSocket _sock, ReticleScript _ret) { sock = _sock; ret = _ret; }