public void LastAim(NetworkMessage netMsg) { Callipso.GameSession _currentSession = sessions.Find(x => x.agents.Find(e => e.user != null && e.user.connectionId == netMsg.conn.connectionId)); // currently in session if (_currentSession == null || !_currentSession.isStarted) { // Not in a session or session is not started netMsg.conn.Disconnect(); return; } MObjects.LastAim mObject = netMsg.ReadMessage <MObjects.LastAim>(); _currentSession.LastAim(netMsg.conn.connectionId, mObject.y, mObject.pos); }
void FixedUpdate() { filler.fillAmount += Time.deltaTime / fillSpeed; if (mobileAgent == null || !mobileAgent.isController) { return; } if (fillSpeed > 0f && filler.fillAmount >= 1 - (Time.deltaTime / fillSpeed) * 8) { if (!aimIsDone && mobileAgent.isController) { aimIsDone = true; AgentInput.current.TryToMove(); MObjects.LastAim mObject = new MObjects.LastAim(); mObject.y = (AgentInput.current.autoTarget != null && GameManager.singleton.skillsHolder.GetChild(skillId).GetComponent <UISkillItem>().skillInfo.skillType == MObjects.SkillType.Mover) ? AgentInput.current.autoTarget.transform.position : mobileAgent.aimPoint; mObject.pos = mobileAgent.transform.position; GameManager.nc.Send(MTypes.LastAim, mObject); mobileAgent.nextAimRequest = -1; // agent cannot aim now. } mobileAgent.nextMove = Time.time + 0.5f; } if (areaFollower) { if (mobileAgent.targetPoint != Vector3.up) { // Area Spell if (GameManager.GetDistance(mobileAgent.targetPoint, mobileAgent.transform.position) > 10) { mobileAgent.targetPoint = mobileAgent.transform.position + (mobileAgent.targetPoint - mobileAgent.transform.position).normalized * 10; } GameManager.singleton.areaFollower.transform.position = mobileAgent.targetPoint; } } }