public void Play(float time, GameObject effect, Action <object> call, object arg) { hideAvatarTime = time - showAvatarTime - 0.6f; if (hideAvatarTime <= 0) { hideAvatarTime = 0.02f; } _time = hideAvatarTime + 0.02f; BBuildChangeAvatar buildChangeAvatar = GetComponent <BBuildChangeAvatar>(); buildChangeAvatar.Play(_time, hideAvatarTime, showAvatarTime, 0.01f, effect); StartCoroutine(DelayCallHandler(_time, call, arg)); }
protected override void OnUpdate() { base.OnUpdate(); if (_team != unitData.legionId) { _preteam = _team; _team = unitData.legionId; if (_preteam == -1) { _preteam = _team; } unitData.death = true; if (_changeInactiveTime <= 0) { _changeInactivePreTeam = _preteam; _changeInactiveTeam = _team; if (!_hasHero) { // 添加经验--占领 War.GetLegionData(_team).levelData.AddExp_Build(unitCtl); } } _changeInactiveTime = changeInactiveTime; Coo.soundManager.PlaySound("effect_get_build"); } if (_changeInactiveTime > 0) { _changeInactiveTime -= Time.deltaTime; if (_changeInactiveTime <= 0 && _changeInactiveTeam != _team) { // 添加经验--占领 War.GetLegionData(_team).levelData.AddExp_Build(unitCtl); } } _hasHero = unitData.hasHero; if (_death != unitData.death) { _death = unitData.death; if (_death) { buildChangeManager.StopAll(); buildChangeAvatar.Play(0, hideAvatarTime, showAvatarTime, 0.02f, effect); } } if (_death) { unitData.deathTime -= Time.deltaTime; if (unitData.deathTime <= 0) { // if(unitData.level > 1) unitData.level -= 1; } } }