Example #1
0
    public static void OnCollisionHappen(BactaController controllerSelf, BactaController otherController)
    {
        //find existing
        var col = collisions.Find(item => item.Item2 == controllerSelf && item.Item1 == otherController);

        if (col == null)
        {
            collisions.Add(new Tuple <BactaController, BactaController>(controllerSelf, otherController));
        }
        else
        {
            collisions.Remove(col);
            //do cross-call
            if (controllerSelf.PlayerType != ObjectType.FRIEND)
            {
                var otherHP = otherController.Health;
                otherController.DoImpact(controllerSelf.PlayerType, controllerSelf.Health);
                controllerSelf.DoImpact(otherController.PlayerType, otherHP);
            }
            else
            {
                var selfHP = controllerSelf.Health;
                controllerSelf.DoImpact(otherController.PlayerType, otherController.Health);
                otherController.DoImpact(controllerSelf.PlayerType, selfHP);
            }
        }
    }
Example #2
0
    private void OnSceneGUI()
    {
        BactaController bactaController = target as BactaController;
        var             angle           = Mathf.Deg2Rad * bactaController.StartAngle;

        Handles.DrawLine(
            bactaController.transform.position,
            bactaController.transform.position + new Vector3(Mathf.Cos(angle), -Mathf.Sin(angle), 0) * 3f
            );
    }