/// <summary> /// 单例模式添加单例实体 /// </summary> /// <returns></returns> public static SmObjectLocator getInstance() { //初始化三维基本对象 if (smObjectLocator == null) { smObjectLocator = new SmObjectLocator(); globeObject = new SceneControl(); flyManagerObject = globeObject.Scene.FlyManager; } return smObjectLocator; }
void Update() { FlyManager fly = flyManager.GetComponent <FlyManager>(); bool birdIsActive = fly.birdIsActive; bool birdIsApproaching = fly.birdIsApproaching; bool peter = birdIsActive && !birdIsApproaching; omniousValue += (birdIsActive?1:-1) * Time.deltaTime; omniousValue = Mathf.Clamp01(omniousValue); rend.material.SetFloat("_Peter", omniousValue); }
// Start is called before the first frame update void Start() { peterHead = GetComponentInChildren <PeterHead>(); flyManager = GameObject.FindObjectOfType <FlyManager>(); PeterEatBehaviour = GetComponentInParent <PeterEatBehaviour>(); spriteRenderer = GetComponentInChildren <SpriteRenderer>(); listCollisions = GetComponentsInChildren <EyeCollision>(); currentCollision = listCollisions[0]; spriteIdle = spriteRenderer.sprite; timeTotalRange = Random.Range(totalMin, totalMax); StopLooking(); }
void Start() { FlyManager.Get().fliesLeft++; clickable = GetComponent <Clickable>(); switch (side) { case Side.Left: sideToAnim = 1; break; case Side.Right: sideToAnim = 2; break; } animator = GetComponent <Animator>(); }
public void UpClick() { FlyManager flm = goold.GetComponent <FlyManager>(); if (!flm.isChoose) { flm.isChoose = true; flm.an2.SetActive(true); flm.an1.SetActive(true); flm.an.enabled = true; flm.an.Play(0); flm.transform.parent = null; flm.clearObj(); Invoke("initFly", 3f); } }
/// <summary> /// 根据sceneControl构造 SampleRun对象 /// </summary> /// <param routestopName="sceneControl"></param> public SampleDesignerRun(Workspace workspace, SceneControl sceneControl) { try { m_workspace = workspace; m_sceneControl = sceneControl; flyManager = m_sceneControl.Scene.FlyManager; //注册事件 m_sceneControl.Tracked += new Tracked3DEventHandler(m_sceneControl_Tracked); m_sceneControl.MouseClick += new MouseEventHandler(m_sceneControl_MouseClick); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public SampleRun(WorkspaceControl workspaceControl, LayersControl layersControl, MapControl mapControl, MapControl mapControl2, MapLayoutControl mapLayoutControl1, ToolStripStatusLabel toolStripStatusLabel2, TextBox textBoxResult, ToolStripStatusLabel toolStripStatusLabel3, SceneControl scenecontrol ) { workspaceControl1 = workspaceControl; workspace1 = workspaceControl1.WorkspaceTree.Workspace; layersControl1 = layersControl; mapControl1 = mapControl; m_mapControlEagleEye = mapControl2; m_mapLayoutControl = mapLayoutControl1; m_toolStrip = toolStripStatusLabel2; m_textBoxResult = textBoxResult; scontrol = scenecontrol; label1 = toolStripStatusLabel3; m_datasource = workspace1.Datasources[0]; m_point3Ds = new Point3Ds(); m_pointName = "Point"; m_geoLine3D = new GeoLine3D(); m_point3DsAll = new Point3Ds(); m_flyManager = scontrol.Scene.FlyManager; m_flyManager.Routes.Clear(); m_flyManager.Scene = scontrol.Scene; m_mapControlEagleEye.MouseMove += new MouseEventHandler(EagleEyeMapMouseMoveHandler); m_mapControlEagleEye.MouseDown += new MouseEventHandler(EagleEyeMapMouseDownHandler); m_mapControlEagleEye.MouseUp += new MouseEventHandler(EagleEyeMapMouseUpHandler); m_mapControlEagleEye.ActionCursorChanging += new ActionCursorChangingEventHandler(EagleEyeMapCursorChangedHandler); mapControl1.Map.Drawn += new MapDrawnEventHandler(MainMapDrawnHandler); scontrol.MouseDown += new System.Windows.Forms.MouseEventHandler(m_sceneControl_MouseDown); scontrol.MouseMove += new System.Windows.Forms.MouseEventHandler(m_sceneControl_MouseMove); Initialize(); }
void Update() { FlyManager fly = flyManager.GetComponent <FlyManager>(); WindowSelector win = windowSelector.GetComponent <WindowSelector>(); bool birdIsActive = fly.birdIsActive; bool birdIsApproaching = fly.birdIsApproaching; bool peter = birdIsActive && !birdIsApproaching; bool cameraShake = win.isSelectingPeter; if (lightType == lightTypes.lamp) { if (!birdIsActive || birdIsApproaching || cameraShake) { float bai = birdIsApproaching? 10:1; float bas = birdIsApproaching? 2:1; //currentIntensity=Mathf.Abs(Mathf.Sin(Time.time*3.14f)+Mathf.Sin(Time.time*147.3f)+Mathf.Sin(Time.time*35.73F))*0.1f+initialIntensity; float bop1 = Mathf.Clamp01(((Mathf.Sin(Time.time * Mathf.PI * bas) + 1) / 2) - 0.9f) * 3 * bai; float bop2 = Mathf.Clamp01(((Mathf.Sin(Time.time * Mathf.PI * Mathf.PI * bas) + 1) / 2) - 0.95f) * 2 * bai; float bop3 = Mathf.Clamp01(((Mathf.Sin(Time.time * 7.35f * bas) + 1) / 2) - 0.95f) * 5 * bai; currentIntensity = (bop1 + bop2 + initialIntensity - bop3); float camShake = (Mathf.Sin(Time.time * 30) + Mathf.Sin(Time.time * 14)) * Mathf.Sin(Time.time * 73); currentIntensity = cameraShake?currentIntensity * camShake:currentIntensity; } else { currentIntensity = Mathf.Clamp01(prevIntensity - 1.0f * Time.deltaTime); } } else if (lightType == lightTypes.firePlace) { float bai = birdIsApproaching? 1:1; float bas = birdIsApproaching? 1:1; float peterIntensity = cameraShake? 0.25f:1; float peterSpeed = cameraShake? 2:1; float peterFlicker1 = cameraShake?Mathf.Sin((Time.time + cycleOffset) * 4.11f) * 3:1; float peterFlicker2 = cameraShake?Mathf.Sin((Time.time + cycleOffset) * 16) * 3:1; float peterFlicker3 = cameraShake?Mathf.Sin((Time.time + cycleOffset) * 2.57f) * 3:1; float bop1 = Mathf.Clamp01(((Mathf.Sin(Time.time * Mathf.PI * bas * peterSpeed * 0.2f) + 1) / 2) - 0.9f * peterFlicker1) * 3 * bai * peterIntensity; float bop2 = Mathf.Clamp01(((Mathf.Sin(Time.time * Mathf.PI * Mathf.PI * bas * peterSpeed * 0.3f) + 1) / 2) - 0.95f * peterFlicker2) * 2 * bai * peterIntensity; float bop3 = Mathf.Clamp01(((Mathf.Sin(Time.time * 0.35f * bas * peterSpeed) + 1) / 2) - 0.95f * peterFlicker3) * 5 * bai * peterIntensity; currentIntensity = (bop1 + bop2 + initialIntensity - bop3); } else if (lightType == lightTypes.directional) { float strength = peter?0.75f:1; float dir = peter?-1:1; float speed = 1.0f; float motion = prevIntensity + strength * speed * Time.deltaTime * dir; curLerp = Mathf.Clamp01(prevLerp + 1.0f * speed * Time.deltaTime * dir); float ci = peter?Mathf.Max(initialIntensity * strength, motion):Mathf.Min(initialIntensity * strength, motion); Vector4 peterColor = new Vector4(1, 0.2f, 0.2f, 1); currentColor = Vector4.Lerp(Vector4.Lerp(initialColor, peterColor, 0.2f), initialColor, curLerp); currentIntensity = ci; } else if (lightType == lightTypes.ambient) { curLerp += (peter?1:-1) * Time.deltaTime; curLerp = Mathf.Clamp01(curLerp); currentIntensity = Mathf.Lerp(initialIntensity, initialIntensity * 0.75f, curLerp); } li.intensity = currentIntensity; li.color = currentColor; if (currentIntensity <= 0) { li.enabled = false; } else { li.enabled = true; } prevIntensity = currentIntensity; prevColor = currentColor; prevLerp = curLerp; }
// Start is called before the first frame update void Start() { soundFly = GetComponent <AudioSource>(); flyManager = GetComponentInParent <FlyManager>(); rend = GetComponent <SpriteRenderer>(); }
public void LeaveScreen() { FlyManager.Get().OnFlyDead(); gameObject.SetActive(false); }
private void Awake() { instance = this; }
void Start() { flyManagerGameObject = GameObject.FindGameObjectWithTag("FlyManager"); flyManager = flyManagerGameObject.GetComponent <FlyManager>(); gameObject.GetComponent <Text>().text = flyManager.atTableWinFlyCount.ToString(); }