// Start is called before the first frame update void Start() { leftX = Camera.main.ViewportToWorldPoint(new Vector3(0, 1, 0)).x; //assign the top left of the screen a position rightX = Camera.main.ViewportToWorldPoint(new Vector3(1, 1, 0)).x; //assign the top right of the screen a position PowerUpTarget = new Vector3(getRand(rightX, leftX), 0); //Grab the position of said unlucky Building/Gun thisGameManager = FindObjectOfType <GameManager>(); thisCrosshairController = FindObjectOfType <CrosshairController>(); }
public static CrosshairController GetInstance() { if (instance == null) { instance = FindObjectOfType <CrosshairController>(); } return(instance); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
void Start() { // 현재 가지고 있는 무기 초기화 playerWeapons = new GameObject[2]; playerWeapons[0] = null; playerWeapons[1] = null; // 크로스헤어 객체 획득 crossHair = CrosshairController.GetInstance(); // 주변에 존재하는 무기를 담을 리스트 aroundWeapons = new List <GameObject>(); // 메인 카메라 획득 playerCamera = CameraControl.GetInstance(); // 애니메이터 컴포넌트 획득 playerAnimator = GetComponent <Animator>(); rb = GetComponent <Rigidbody>(); // 리코의 등과 오른손에 아이템을 장착할 위치 획득 playerBack = GameObject.FindObjectOfType <PlayerBack>(); playerBack2 = GameObject.FindObjectOfType <PlayerBack2>(); playerRightHand = GameObject.FindObjectOfType <PlayerRightHand>(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); serializedObject.Update(); EditorGUILayout.Space(); _list.DoLayoutList(); serializedObject.ApplyModifiedProperties(); //draw on the crosshair in the template CrosshairTemplate t = (CrosshairTemplate)target; Rect totalRect = GUILayoutUtility.GetAspectRect(1, GUILayout.MaxWidth(300), GUILayout.MaxHeight(300)); //Get a quick reference to the center Vector2 center = totalRect.center; foreach (var e in t.elements) { //draw the surrounding lines only if there are more than 0 if (e.count != 0) { float movement = e.orbitStartAngle; //Draw the lines float angleIncrease = e.orbitSize / e.count; Color col = e.overrideColor ? e.color : t.color; for (int i = 0; i < e.count; i++) { movement += angleIncrease; //GUIUtility.RotateAroundPivot(movement, center); float fakeSpread = (Mathf.Sin(Time.time) + 2); Vector2 size = e.size; if (e.scaleWithSpread.HasFlag(EffectAxis.X)) { size.x *= fakeSpread * 10; } if (e.scaleWithSpread.HasFlag(EffectAxis.Y)) { size.y *= fakeSpread * 10; } //more positive means more down in this viewer // simulate scaling by horizontal fov var mid = center + scale * (e.offset + (e.offsetWithSpread ? e.spreadOffsetDirection * fakeSpread * 10 : Vector2.zero)); //apply center offset mid += new Vector2(1, -1) * CrosshairController.MaskFromEffects(e.offsetFromCenter) * size * 0.5f; mid = (mid - center).Rotate(movement) + center; GUIUtility.RotateAroundPivot(e.rotationOffset + movement, mid); if (e.sprite != null) { GUI.color = col; Rect rect = e.sprite.rect; //support drawing sprites that are not the entire texture rect.x /= e.sprite.texture.width; rect.y /= e.sprite.texture.height; rect.width /= e.sprite.texture.width; rect.height /= e.sprite.texture.height; GUI.DrawTextureWithTexCoords(RectAround(mid, size), e.sprite.texture, rect); GUI.color = Color.white; } else { //draw the normal square EditorGUI.DrawRect(RectAround(mid, size), col); } //reset the rotation back to normal GUIUtility.RotateAroundPivot(-e.rotationOffset - movement, mid); //GUIUtility.RotateAroundPivot(-movement, center); } } } }
internal static void PopulateAssets() { if (!mainAssetBundle) { Debug.LogError("There is no AssetBundle to load assets from."); return; } swordHitSoundEvent = CreateNetworkSoundEventDef("HenrySwordHit"); punchHitSoundEvent = CreateNetworkSoundEventDef("HenryPunchHit"); nemSwordHitSoundEvent = CreateNetworkSoundEventDef("NemrySwordHit"); dustEffect = LoadEffect("HenryDustEffect"); bombExplosionEffect = LoadEffect("BombExplosionEffect", "HenryBombExplosion"); bazookaExplosionEffect = LoadEffect("HenryBazookaExplosionEffect", "HenryBazookaExplosion"); bazookaMuzzleFlash = LoadEffect("HenryBazookaMuzzleFlash"); muzzleFlashEnergy = LoadEffect("NemryMuzzleFlashEnergy", true); minibossEffect = mainAssetBundle.LoadAsset <GameObject>("NemryMinibossIndicator"); swordChargeFinishEffect = LoadEffect("SwordChargeFinishEffect"); swordChargeEffect = mainAssetBundle.LoadAsset <GameObject>("SwordChargeEffect"); if (swordChargeEffect) { swordChargeEffect.AddComponent <ScaleParticleSystemDuration>().particleSystems = swordChargeEffect.GetComponentsInChildren <ParticleSystem>(); swordChargeEffect.GetComponent <ScaleParticleSystemDuration>().initialDuration = 1.5f; } if (bombExplosionEffect) { ShakeEmitter shakeEmitter = bombExplosionEffect.AddComponent <ShakeEmitter>(); shakeEmitter.amplitudeTimeDecay = true; shakeEmitter.duration = 0.5f; shakeEmitter.radius = 200f; shakeEmitter.scaleShakeRadiusWithLocalScale = false; shakeEmitter.wave = new Wave { amplitude = 1f, frequency = 40f, cycleOffset = 0f }; shakeEmitter = bazookaExplosionEffect.AddComponent <ShakeEmitter>(); shakeEmitter.amplitudeTimeDecay = true; shakeEmitter.duration = 0.4f; shakeEmitter.radius = 100f; shakeEmitter.scaleShakeRadiusWithLocalScale = false; shakeEmitter.wave = new Wave { amplitude = 1f, frequency = 30f, cycleOffset = 0f }; } swordSwingEffect = Assets.LoadEffect("HenrySwordSwingEffect", true); swordHitImpactEffect = Assets.LoadEffect("ImpactHenrySlash"); punchSwingEffect = Assets.LoadEffect("HenryFistSwingEffect", true); punchImpactEffect = Assets.LoadEffect("ImpactHenryPunch"); fistBarrageEffect = Assets.LoadEffect("FistBarrageEffect", true); if (fistBarrageEffect) { fistBarrageEffect.GetComponent <ParticleSystemRenderer>().material.shader = hotpoo; } bazookaCrosshair = PrefabAPI.InstantiateClone(LoadCrosshair("ToolbotGrenadeLauncher"), "HenryBazookaCrosshair", false); CrosshairController crosshair = bazookaCrosshair.GetComponent <CrosshairController>(); crosshair.skillStockSpriteDisplays = new CrosshairController.SkillStockSpriteDisplay[0]; bazookaCrosshair.transform.Find("StockCountHolder").gameObject.SetActive(false); bazookaCrosshair.transform.Find("Image, Arrow (1)").gameObject.SetActive(true); crosshair.spriteSpreadPositions[0].zeroPosition = new Vector3(32f, 34f, 0f); crosshair.spriteSpreadPositions[2].zeroPosition = new Vector3(-32f, 34f, 0f); bazookaCrosshair.transform.GetChild(1).gameObject.SetActive(false); trackerPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/HuntressTrackingIndicator"), "HenryTrackerPrefab", false); trackerPrefab.transform.Find("Core Pip").gameObject.GetComponent <SpriteRenderer>().color = Color.white; trackerPrefab.transform.Find("Core Pip").localScale = new Vector3(0.15f, 0.15f, 0.15f); trackerPrefab.transform.Find("Core, Dark").gameObject.GetComponent <SpriteRenderer>().color = Color.black; trackerPrefab.transform.Find("Core, Dark").localScale = new Vector3(0.1f, 0.1f, 0.1f); foreach (SpriteRenderer i in trackerPrefab.transform.Find("Holder").gameObject.GetComponentsInChildren <SpriteRenderer>()) { if (i) { i.gameObject.transform.localScale = new Vector3(0.2f, 0.2f, 1f); i.color = Color.white; } } shotgunTracer = Resources.Load <GameObject>("Prefabs/Effects/Tracers/TracerCommandoShotgun").InstantiateClone("HenryBulletTracer", true); if (!shotgunTracer.GetComponent <EffectComponent>()) { shotgunTracer.AddComponent <EffectComponent>(); } if (!shotgunTracer.GetComponent <VFXAttributes>()) { shotgunTracer.AddComponent <VFXAttributes>(); } if (!shotgunTracer.GetComponent <NetworkIdentity>()) { shotgunTracer.AddComponent <NetworkIdentity>(); } foreach (LineRenderer i in shotgunTracer.GetComponentsInChildren <LineRenderer>()) { if (i) { Material bulletMat = UnityEngine.Object.Instantiate <Material>(i.material); bulletMat.SetColor("_TintColor", new Color(0.68f, 0.58f, 0.05f)); i.material = bulletMat; i.startColor = new Color(0.68f, 0.58f, 0.05f); i.endColor = new Color(0.68f, 0.58f, 0.05f); } } AddNewEffectDef(shotgunTracer); spearSwingEffect = Assets.LoadEffect("NemrySpearSwingEffect"); nemSwordSwingEffect = Assets.LoadEffect("NemrySwordSwingEffect", true); nemSwordStabSwingEffect = Assets.LoadEffect("NemrySwordStabSwingEffect", true); nemSwordHeavySwingEffect = Assets.LoadEffect("NemryHeavySwordSwingEffect", true); nemSwordHitImpactEffect = Assets.LoadEffect("ImpactNemrySlash"); energyBurstEffect = LoadEffect("EnergyBurstEffect"); smallEnergyBurstEffect = LoadEffect("EnergySmallBurstEffect"); energyTracer = CreateTracer("TracerHuntressSnipe", "NemryEnergyTracer"); LineRenderer line = energyTracer.transform.Find("TracerHead").GetComponent <LineRenderer>(); Material tracerMat = UnityEngine.Object.Instantiate <Material>(line.material); line.startWidth *= 0.25f; line.endWidth *= 0.25f; // this did not work. //tracerMat.SetColor("_TintColor", new Color(78f / 255f, 80f / 255f, 111f / 255f)); line.material = tracerMat; }
private void Start() { hitmarkerImage.color = new Color(1f, 1f, 1f, 0f); crosshair = FindObjectOfType <CrosshairController>(); }
private void Awake() { cam = Camera.main; crosshairController = FindObjectOfType <CrosshairController>(); }
// Start is called before the first frame update void Start() { controller = GetComponent <CrosshairController>(); }
private void Awake() { singleton = this; }
void Start() { cs = new CrosshairController(); thisCamera = this.gameObject.GetComponent <Camera>(); _player = GameObject.Find("Player").GetComponent <CharController>(); }