private void CreateLine(int i) { GameObject Line = new GameObject("Line"); int[] atomsIds = bondEPList[i] as int[]; LineRenderer lineRenderer = Line.AddComponent <LineRenderer>(); lineRenderer.SetVertexCount(2); lineRenderer.material = new Material(Shader.Find("Particles/Alpha Blended")); if (Line.GetComponent <LineUpdate>() == null) { Line.AddComponent <LineUpdate>(); } LineUpdate comp = Line.GetComponent <LineUpdate>(); // comp.atompointer1=(GameObject)MoleculeModel.atoms[atomsIds[0]]; // comp.atompointer2=(GameObject)MoleculeModel.atoms[atomsIds[1]]; if (UI.UIData.atomtype == UI.UIData.AtomType.particleball) { comp.atompointer1 = (GameObject)MoleculeModel.atoms[atomsIds[0]]; comp.atompointer2 = (GameObject)MoleculeModel.atoms[atomsIds[1]]; } else { GenericManager manager = Molecule.View.DisplayMolecule.GetManagers()[0]; comp.atompointer1 = manager.GetBall(Molecule.Model.MoleculeModel.atoms.Count - 1 - atomsIds[0]); comp.atompointer2 = manager.GetBall(Molecule.Model.MoleculeModel.atoms.Count - 1 - atomsIds[1]); } comp.enabled = true; Line.tag = "Club"; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { this.animator = animator; state = animator.GetComponentInChildren <TurretState> (); sp = animator.GetComponent <TurretSP> (); update = animator.GetComponentInChildren <LineUpdate> (); sp.turretSP.SetNone(); update.DisableLine(); }
// Use this for initialization void Start() { hs = GetComponent <HealthSystem> (); body = GetComponent <Rigidbody2D> (); lu = GetComponent <LineUpdate> (); if (hs) { hs.OnObjectDead += StartExplosion; hs.destoryDelay = Mathf.Max(hs.destoryDelay, explosionDelay); } }
void EnableLine(Transform objTrans) { LineUpdate lu = GetComponent <LineUpdate> (); if (lu) { lu.enabled = true; } foreach (Transform child in objTrans) { ObjectIdentity oi = child.GetComponent <ObjectIdentity> (); if (oi && oi.objType == ObjectType.Line) { child.gameObject.SetActive(true); } } }
// Use this for initialization void Start() { cs = GetComponent <ControlStatus> (); lineUpdate = GetComponent <LineUpdate> (); picker = GetComponent <ServerPicker> (); animator = GetComponentInParent <Animator> (); cs.OnLinkedByEnemy += DisableLine; cs.OnCutByPlayer += SetPlayerCut; cs.OnLinkedByPlayer += SetPlayerLink; HealthSystem hs = cs.Hacker.GetComponent <HealthSystem> (); if (hs) { hs.OnObjectDead += SetPlayerUnLink; // hs.OnObjectDead += ForceDisconnect; } }
// Use this for initialization void Start() { body = GetComponent <Rigidbody2D> (); fov = GetComponent <FieldOfView> (); cs = GetComponent <ControlStatus> (); lu = GetComponent <LineUpdate> (); animator = GetComponent <Animator> (); hd = GetComponent <HurtAndDamage> (); // set default targets targets = playerTargets; // add actions cs.OnLinkedByEnemy += SetPlayerTargets; cs.OnLinkedByPlayer += SetEnemyTargets; cs.OnLinkedByPlayer += SetPlayerLink; cs.OnCutByPlayer += SetCut; cs.OnCutByEnemy += SetCut; hd.canHurtOther = false; if (cs.controller == Controller.Boss) { animator.SetTrigger("enemyLink"); } if (_incomingVelocity == Vector3.zero) { _incomingVelocity = Vector3.up; } canSetIncomingVelocity = true; }