void CheckAttackEffect() { if (attackCD > 0f && 1f - attackCD > attackEffectTime / args.attackSpeed && !attackEffected) { attackEffected = true; if (attackTarget != null) { ArgsController targetArgs = attackTarget.GetComponent <ArgsController>(); if (targetArgs != null) { GameObject wave = (GameObject)Instantiate(args.weaponWave, transform.position, transform.rotation); WaveController waveController = wave.GetComponent <WaveController>(); waveController.target = attackTarget; waveController.damage = args.att; if (attackSound != null && !(GetComponent <AudioSource>().clip == attackSound && GetComponent <AudioSource>().isPlaying)) { GetComponent <AudioSource>().clip = attackSound; GetComponent <AudioSource>().Play(); } } attackTarget = null; } } }
public void C_Execute(Executer exe, ArgsController args, Socket client) { ServerLogic.ServerEvents.Info?.Invoke("System execute!"); ServerLogic.MainLogic.GetInstance.SendMessage(ServerLogic.OClient.Info, "SYSTEM EXECUTED!", client); Thread.Sleep(5000); ServerLogic.ServerEvents.Info?.Invoke("System execute!!!"); }
public Executer(bool gc, string modulesFolder, int Timeout = 15000) { COMMANDTIMEOUT = Timeout; ModulesFolder = modulesFolder; ArgsControl = new ArgsController(); CommandsHeap = new List <ICMD>(); MODController = new Modules.ModuleController(this); GarbageCollect = gc; }
public void C_Execute(Executer exe, ArgsController args) { if (args.SubCmds.IsSubcmd(0, "all")) { Interactor.Logger.Info("Миры:"); foreach (var world in Interactor.WorldController) { Interactor.Logger.Info($"{world.WorldName} | {world.BehaviourID}"); } } }
public void C_Execute(Executer exe, ArgsController args, Socket client) { if (args.SubCmds.IsSubcmd(0, "login")) { string login = string.IsNullOrEmpty(args.StrArgs[0]) ? throw new ArgumentNullException("login") : args.StrArgs[0]; string password = string.IsNullOrEmpty(args.StrArgs[1]) ? throw new ArgumentNullException("password") : args.StrArgs[1]; Thread.Sleep(5000); //ClientLogic.ClientLogic.GetInstance.Handler.Client.Send(BytesCompress.CompressPacket(BytesTransformation.TransformIt(login, password), "Auth")); } else if (args.SubCmds.IsSubcmd(0, "register") || args.SubCmds.IsSubcmd(0, "reg")) { } }
public void C_Execute(Executer exe, ArgsController args) { //выбор мира if (args.SubCmds.IsSubcmd(0, "wselect")) { string wrldName = args.StrArgs[0]; if (WrldSelected != null && wrldName == WrldSelected.WorldName) { Interactor.Logger.Error($"Мир {wrldName} уже выбран!"); return; } if (Interactor.WorldController.Any((a) => a.WorldName == wrldName)) { WrldSelected = Interactor.WorldController.First((a) => a.WorldName == wrldName); Interactor.Logger.Success($"Мир {WrldSelected.WorldName} выбран! | {WrldSelected.BehaviourID}"); } else { Interactor.Logger.Error($"Мир {wrldName} не найден!"); } } else if (args.SubCmds.IsSubcmd(0, "obj")) { if (WrldSelected is null) { Interactor.Logger.Error("Мир не выбран!"); return; } if (args.SubCmds.IsSubcmd(1, "add")) { string whatIs = args.StrArgs[0]; if (ObjsToCreate.Any(a => a.ObjectName == whatIs)) { WrldSelected.AddObject(ObjsToCreate.Find(a => a.ObjectName == whatIs)); Interactor.Logger.Success($"Объект {whatIs} добавлен в мир!"); } else { Interactor.Logger.Error($"Объект {whatIs} не найден!"); } } else if (args.SubCmds.IsSubcmd(1, "list")) { Interactor.Logger.Info($"Объекты в мире ({WrldSelected.ObjectsInTheWorld.Count}): "); foreach (var obj in WrldSelected.ObjectsInTheWorld) { Interactor.Logger.Info($"{obj.ObjectName} | {obj.BehaviourID}"); } } } }
void Update() { CheckFallDown(); ArgsController args = GetComponent <ArgsController> (); if (args != null && args.hp == 0f) { GetComponent <RemainStanding>().enabled = false; dieTime += Time.deltaTime; if (dieTime >= 5f) { Application.LoadLevel(levelName); } } }
void CheckFallDown() { fallDownCd = Mathf.Max(fallDownCd - Time.deltaTime, 0f); if (transform.position.y < fallDownY) { ArgsController args = GetComponent <ArgsController>(); if (args != null) { if (fallDownCd == 0f) { fallDownCd = 1f; args.BeingAttacked(fallDownDamage); } } } }
static void Main(string[] args) { // g.debug true if defined DEBUG #if DEBUG g.Debug = true; #endif var split = Application.ExecutablePath.Split('\\'); g.CurrentPath = Application.ExecutablePath.Replace(split[split.Length - 1], ""); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // init sound engine g.engine = new SBEngine(); // init frame g.MainFrame = new Frame(); g.Settings = new WindowSettings(); g.tracksFrame = new TracksFrame(); g.hotkeyManager = new HotkeyManager(); // // arg controller // ArgsController argsController = new ArgsController('-', args); var enableConsole = new ArgsController.Arg("enableConsole", ref argsController, null, () => { if (!g.Debug) { WinAPI.FreeConsole(); } }); var appSettings = new ArgsController.Arg("appSettings", ref argsController, (ArgStruct arg) => g.engine.config.LoadAppPath(arg.value), () => g.engine.config.LoadApp()); argsController.CheckArgs(); // setup font SoundElement.paintFont = SoundElement.CreateFont(); g.ReloadAll(); Application.Run(g.MainFrame); }
private static void Main(string[] args) { string prefix = "ArgsControllerTester"; var argsController = new ArgsController(prefix, prefix + "File"); if (args.Length > 0) { argsController.AddArg(args[0]); } if (!argsController.IsOwner) { return; } argsController.ArgAddAsync += ArgsController_ArgAddAsync; argsController.BeginFollow(); Console.ReadLine(); }
void Start() { args = GetComponent <ArgsController> (); stuff = GetComponent <StuffController> (); originPosition = transform.position; }
public ArgsTemplate(ArgsController controller) { CONTROLLER = controller; }
public void Start() { player = GameObject.Find("player"); args = GetComponent <ArgsController>(); Idle(); }
void SetWeapon(int type, float complished) { GetComponent <WeaponController> ().SetWeapon(type); int totalCnt = 0, totalQuality = 0; int attCnt = 0, attQ = 0; int defCnt = 0, defQ = 0; int speedCnt = 0, speedQ = 0; for (int r = 0; r < maxR; r++) { for (int c = 0; c < maxC; c++) { if (layout[r, c] != -1) { totalCnt++; totalQuality += layout[r, c] + 1; if (r < maxR / 3) { attCnt++; attQ += layout[r, c] + 1; } else if (r < maxR * 2 / 3) { defCnt++; defQ += layout[r, c] + 1; } else { speedCnt++; speedQ += layout[r, c] + 1; } } } } float quality = (totalCnt == 0) ? 1f : (float)totalQuality / totalCnt; float attBonus = (attCnt == 0) ? 1f : (float)attQ / attCnt; float defBonus = (defCnt == 0) ? 1f : (float)defQ / defCnt; float speedBonus = (speedCnt == 0) ? 1f : Mathf.Pow((float)speedQ / speedCnt, 0.3f); float k = Mathf.Pow(complished * quality, 0.5f); ArgsController args = GetComponent <ArgsController> (); WeaponArgs weapon = (type == -1) ? (new WeaponArgs()) : weaponArgs [type]; args.weaponComplish = complished; args.weaponQuality = quality; args.attBonus = attBonus; args.defBonus = defBonus; args.speedBonus = speedBonus; args.weaponTexture = weapon.texture; if (type == -1) { args.weaponWave = emptyWave; GetComponent <PlayerController>().attackSound = emptySound; } else { args.weaponWave = weapon.weaponWave; GetComponent <PlayerController>().attackSound = weapon.weaponSound; } args.weaponName = weapon.name; float hpRate = (float)args.hp / args.maxHp; args.maxHp = weapon.maxHp * k; args.hp = args.maxHp * hpRate; args.deltaHp = weapon.deltaHp; args.att = weapon.att * k * attBonus; args.def = weapon.def * k * defBonus; args.range = weapon.range * speedBonus; args.moveSpeed = weapon.moveSpeed * speedBonus; args.attackSpeed = weapon.attackSpeed * speedBonus; }
public void C_Execute(Executer exe, ArgsController args) { AEvents.OutputAction("Commands:", AEvents.OutTypes.Info); AEvents.OutputAction("...", AEvents.OutTypes.Warning); }
void Start() { player = GameObject.Find("player"); args = player.GetComponent <ArgsController> (); }
public void C_Execute(Executer exe, ArgsController args) { AEvents.OutputAction("Before Sleep!", AEvents.OutTypes.Info); Thread.Sleep(20000); AEvents.OutputAction("After Sleep!", AEvents.OutTypes.Info); }